Skip to content

Commit 60ff297

Browse files
committed
safeguard null rows by filtering rows in query
1 parent 212cd02 commit 60ff297

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/Http/Controllers/ReportsController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,9 @@ public function getAssetAcceptanceReport($deleted = false) : View
11481148
$query->withTrashed();
11491149
}
11501150

1151-
$itemsForReport = $query->get()->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
1151+
$itemsForReport = $query->get()
1152+
->filter(fn ($unaccepted) => $unaccepted->checkoutable)
1153+
->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
11521154

11531155
return view('reports/unaccepted_assets', compact('itemsForReport','showDeleted' ));
11541156
}
@@ -1288,7 +1290,9 @@ public function postAssetAcceptanceReport($deleted = false) : Response
12881290
$acceptances->withTrashed();
12891291
}
12901292

1291-
$itemsForReport = $acceptances->get()->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
1293+
$itemsForReport = $acceptances->get()
1294+
->filter(fn ($unaccepted) => $unaccepted->checkoutable)
1295+
->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
12921296

12931297
$rows = [];
12941298

0 commit comments

Comments
 (0)