Added missing logging back in

This commit is contained in:
snipe 2017-05-09 15:30:45 -07:00
parent 5614578710
commit ee2c67a65f
4 changed files with 61 additions and 2 deletions

View file

@ -183,6 +183,15 @@ class AccessoriesController extends Controller
// Was the accessory updated? // Was the accessory updated?
if ($accessory->save()) { 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 // Redirect to the updated accessory page
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success')); return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
} }
@ -215,6 +224,13 @@ class AccessoriesController extends Controller
} else { } else {
$accessory->delete(); $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 // Redirect to the locations management page
return redirect()->to('admin/accessories')->with('success', trans('admin/accessories/message.delete.success')); return redirect()->to('admin/accessories')->with('success', trans('admin/accessories/message.delete.success'));

View file

@ -454,6 +454,19 @@ class AssetsController extends Controller
if ($asset->save()) { if ($asset->save()) {
// Redirect to the new asset page // Redirect to the new asset page
$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')); \Session::flash('success', trans('admin/hardware/message.update.success'));
return response()->json(['redirect_url' => route("view/hardware", $assetId)]); return response()->json(['redirect_url' => route("view/hardware", $assetId)]);
} }
@ -488,6 +501,13 @@ class AssetsController extends Controller
$asset->delete(); $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 // Redirect to the asset management page
return redirect()->to('hardware')->with('success', trans('admin/hardware/message.delete.success')); return redirect()->to('hardware')->with('success', trans('admin/hardware/message.delete.success'));

View file

@ -189,6 +189,15 @@ class ConsumablesController extends Controller
$consumable->qty = Helper::ParseFloat(e(Input::get('qty'))); $consumable->qty = Helper::ParseFloat(e(Input::get('qty')));
if ($consumable->save()) { 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')); return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
} }
@ -216,6 +225,13 @@ class ConsumablesController extends Controller
$consumable->delete(); $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 // Redirect to the locations management page
return redirect()->to('admin/consumables')->with('success', trans('admin/consumables/message.delete.success')); return redirect()->to('admin/consumables')->with('success', trans('admin/consumables/message.delete.success'));

View file

@ -412,6 +412,13 @@ class LicensesController extends Controller
$licenseseats->delete(); $licenseseats->delete();
$license->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) public function getView($licenseId = null)
{ {
$license = License::find($licenseId); $license = License::withTrashed()->find($licenseId);
$license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset'); $license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset');
if (isset($license->id)) { if (isset($license->id)) {