/**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('devices', function ($slug) {
         return \App\Device::findBySlugOrFail($slug);
     });
     $router->bind('types', function ($slug) {
         return \App\DeviceType::findBySlugOrFail($slug);
     });
     $router->bind('locations', function ($slug) {
         return \App\DeviceLocation::findBySlugOrFail($slug);
     });
     $router->bind('admins', function ($slug) {
         return \App\User::findBySlugOrFail($slug);
     });
     $router->bind('systemusers', function ($slug) {
         return \App\User::findBySlugOrFail($slug);
     });
     $router->bind('activitylogs', function ($id) {
         return \App\Activity::findOrFail($id);
     });
     $router->bind('userlogs', function ($id) {
         return \App\UserLog::findOrFail($id);
     });
     $router->bind('authuser', function ($slug) {
         return \App\User::findBySlugOrFail($slug);
     });
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     \App\Device::observe('App\\Observers\\DeviceObserver');
     \App\DeviceType::observe('App\\Observers\\DeviceTypeObserver');
     \App\DeviceLocation::observe('App\\Observers\\DeviceLocationObserver');
     \App\User::observe('App\\Observers\\UserObserver');
 }
 /**
  * Get Lists of items.
  * @param  String $value Column from database table.
  * @param  String $key   Column from database table
  * @return Collection        Collection Of Items.
  */
 public function lists($value, $key = '')
 {
     return \App\DeviceLocation::lists($value, $key);
 }
 /**
  * Update existing device.
  * @param  Request $request Request for updating a device.
  * @param  \App\Device  $device  Device Model.
  * @return \App\Device           Device Model.
  */
 public function update(Requests\Request $request, Model $device)
 {
     $device->name = trim($request->name);
     $device->model = trim($request->model);
     $device->brand = trim($request->brand);
     $device->serial = trim($request->serial);
     \App\DeviceType::find($request->type_id)->devices()->save($device);
     \App\DeviceLocation::find($request->location_id)->devices()->save($device);
     $device->description = trim($request->description);
     $device->resluggify();
     $device->save();
     return $device;
 }