Prevent hard fail when retrieving acceptance data

This commit is contained in:
Ivan Nieto Vivanco 2023-05-01 16:50:18 -06:00
parent 1b2d830380
commit 6936d76661

View file

@ -159,6 +159,9 @@ class AcceptanceController extends Controller
case 'App\Models\Asset':
$pdf_view_route ='account.accept.accept-asset-eula';
$asset_model = AssetModel::find($item->model_id);
if (!$asset_model) {
return redirect()->back()->with('error', trans('admin/models/message.does_not_exist'));
}
$display_model = $asset_model->name;
$assigned_to = User::find($acceptance->assigned_to_id)->present()->fullName;
break;