Example #1
0
 /**
  * Retore a deleted asset.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @param int $assetId
  * @since [v1.0]
  * @return View
  */
 public function getRestore($assetId = null)
 {
     // Get user information
     $asset = Asset::withTrashed()->find($assetId);
     if (!Company::isCurrentUserHasAccess($asset)) {
         return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
     } elseif (isset($asset->id)) {
         // Restore the asset
         Asset::withTrashed()->where('id', $assetId)->restore();
         return redirect()->route('hardware')->with('success', trans('admin/hardware/message.restore.success'));
     } else {
         return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
     }
 }