Short circuit checkout logic to prevent iterating if we're not checking out to an asset

This commit is contained in:
Daniel Meltzer 2020-05-23 11:48:02 -04:00
parent 7a76cb08a0
commit fe74394ae6
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0

View file

@ -206,11 +206,13 @@ class BulkAssetsController extends Controller
$asset_ids = array_filter($request->get('selected_assets'));
if(request('checkout_to_type') =='asset') {
foreach ($asset_ids as $asset_id) {
if ($target->id == $asset_id && request('checkout_to_type') =='asset') {
if ($target->id == $asset_id) {
return redirect()->back()->with('error', 'You cannot check an asset out to itself.');
}
}
}
$checkout_at = date("Y-m-d H:i:s");
if (($request->filled('checkout_at')) && ($request->get('checkout_at')!= date("Y-m-d"))) {
$checkout_at = e($request->get('checkout_at'));