diff --git a/app/Http/Controllers/AccessoriesController.php b/app/Http/Controllers/AccessoriesController.php index 58e5a721b..6bf5c8f62 100755 --- a/app/Http/Controllers/AccessoriesController.php +++ b/app/Http/Controllers/AccessoriesController.php @@ -183,6 +183,15 @@ class AccessoriesController extends Controller // Was the accessory updated? if ($accessory->save()) { + + $logaction = new Actionlog(); + $logaction->item_type = Accessory::class; + $logaction->item_id = $accessory->id; + $logaction->created_at = date("Y-m-d H:i:s"); + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('update'); + + // Redirect to the updated accessory page return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success')); } @@ -215,6 +224,13 @@ class AccessoriesController extends Controller } else { $accessory->delete(); + $logaction = new Actionlog(); + $logaction->item_type = Accessory::class; + $logaction->item_id = $accessory->id; + $logaction->created_at = date("Y-m-d H:i:s"); + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('deleted'); + // Redirect to the locations management page return redirect()->to('admin/accessories')->with('success', trans('admin/accessories/message.delete.success')); diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 8ad41b9cc..673082a95 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -454,7 +454,20 @@ class AssetsController extends Controller if ($asset->save()) { // Redirect to the new asset page - \Session::flash('success', trans('admin/hardware/message.update.success')); + + $logaction = new Actionlog(); + $logaction->item_type = Asset::class; + $logaction->item_id = $asset->id; + $logaction->created_at = date("Y-m-d H:i:s"); + if (Input::has('rtd_location_id')) { + $logaction->location_id = e(Input::get('rtd_location_id')); + } + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('update'); + + + + \Session::flash('success', trans('admin/hardware/message.update.success')); return response()->json(['redirect_url' => route("view/hardware", $assetId)]); } \Input::flash(); @@ -488,6 +501,13 @@ class AssetsController extends Controller $asset->delete(); + $logaction = new Actionlog(); + $logaction->item_type = Asset::class; + $logaction->item_id = $asset->id; + $logaction->created_at = date("Y-m-d H:i:s"); + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('deleted'); + // Redirect to the asset management page return redirect()->to('hardware')->with('success', trans('admin/hardware/message.delete.success')); diff --git a/app/Http/Controllers/ConsumablesController.php b/app/Http/Controllers/ConsumablesController.php index 92673ac45..adaa6cb70 100644 --- a/app/Http/Controllers/ConsumablesController.php +++ b/app/Http/Controllers/ConsumablesController.php @@ -189,6 +189,15 @@ class ConsumablesController extends Controller $consumable->qty = Helper::ParseFloat(e(Input::get('qty'))); if ($consumable->save()) { + + $logaction = new Actionlog(); + $logaction->item_type = Consumable::class; + $logaction->item_id = $consumable->id; + $logaction->created_at = date("Y-m-d H:i:s"); + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('update'); + + return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.update.success')); } @@ -216,6 +225,13 @@ class ConsumablesController extends Controller $consumable->delete(); + $logaction = new Actionlog(); + $logaction->item_type = Consumable::class; + $logaction->item_id = $consumable->id; + $logaction->created_at = date("Y-m-d H:i:s"); + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('deleted'); + // Redirect to the locations management page return redirect()->to('admin/consumables')->with('success', trans('admin/consumables/message.delete.success')); diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index b3465328a..4e5bb6792 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -412,6 +412,13 @@ class LicensesController extends Controller $licenseseats->delete(); $license->delete(); + $logaction = new Actionlog(); + $logaction->item_type = License::class; + $logaction->item_id = $license->id; + $logaction->created_at = date("Y-m-d H:i:s"); + $logaction->user_id = Auth::user()->id; + $log = $logaction->logaction('deleted'); + @@ -744,7 +751,7 @@ class LicensesController extends Controller public function getView($licenseId = null) { - $license = License::find($licenseId); + $license = License::withTrashed()->find($licenseId); $license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset'); if (isset($license->id)) {