From 9ae7d0b23a3e128bbbdda30f44bbd5fb28375550 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 20 Oct 2021 17:01:25 -0700 Subject: [PATCH] when parent asset is assigned to other location, children assets location are updated as well. --- app/Http/Controllers/CheckInOutRequest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/CheckInOutRequest.php b/app/Http/Controllers/CheckInOutRequest.php index c521c7a3ef..6dd7e4aba3 100644 --- a/app/Http/Controllers/CheckInOutRequest.php +++ b/app/Http/Controllers/CheckInOutRequest.php @@ -39,6 +39,8 @@ trait CheckInOutRequest switch (request('checkout_to_type')) { case 'location': $asset->location_id = $target->id; + Asset::where('assigned_type', 'App\Models\Asset')->where('assigned_to', $asset->id) + ->update(['location_id' => $asset->location_id]); break; case 'asset': $asset->location_id = $target->rtd_location_id;