Skip to content

Commit

Permalink
Add a boolean variable and condition to handle the call to checkedOut…
Browse files Browse the repository at this point in the history
…ToUser() method
  • Loading branch information
inietov committed Sep 11, 2023
1 parent a49d3fe commit 9cbd2d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Http/Controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,12 @@ public function getAssetAcceptanceReport($deleted = false)

$assetsForReport = $acceptances
->filter(function ($acceptance) {
return $acceptance->checkoutable_type == 'App\Models\Asset' && $acceptance->checkoutable->checkedOutToUser();
$acceptance_checkoutable_flag = false;
if ($acceptance->checkoutable){
$acceptance_checkoutable_flag = $acceptance->checkoutable->checkedOutToUser();
}

return $acceptance->checkoutable_type == 'App\Models\Asset' && $acceptance_checkoutable_flag;
})
->map(function($acceptance) {
return ['assetItem' => $acceptance->checkoutable, 'acceptance' => $acceptance];
Expand Down

0 comments on commit 9cbd2d0

Please sign in to comment.