add property check

This commit is contained in:
Godfrey M 2024-12-02 14:27:04 -08:00
parent ab67c48352
commit 983b78edd9

View file

@ -1154,14 +1154,14 @@ class ReportsController extends Controller
} }
// Only send notification if assigned // Only send notification if assigned
if ($assetItem->assignedTo->email) { if ($assetItem->assignedTo?->email) {
Mail::to($assetItem->assignedTo->email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))->locale($assetItem->assignedTo?->locale)); Mail::to($assetItem->assignedTo->email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))->locale($assetItem->assignedTo?->locale));
} else { } else {
Mail::to($assetItem->assignedTo->email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))); Mail::to($assetItem->assignedTo->email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance)));
} }
if ($assetItem->assignedTo->email == ''){ if ($assetItem->assignedTo?->email == ''){
return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.no_email')); return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.no_email'));
} }