public function destroy($id)
 {
     $depreciation = \App\Models\Depreciation::find($id);
     $depreciation->delete();
     return redirect()->back();
 }
 /**
  * Validates and deletes a selected depreciation.
  *
  * This is a hard-delete. We do not currently soft-delete depreciations.
  *
  * @author [A. Gianotto] [<snipe@snipe.net]
  * @since [v1.0]
  * @return Redirect
  */
 public function getDelete($depreciationId)
 {
     // Check if the depreciation exists
     if (is_null($depreciation = Depreciation::find($depreciationId))) {
         // Redirect to the blogs management page
         return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.not_found'));
     }
     if ($depreciation->has_models() > 0) {
         // Redirect to the asset management page
         return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.assoc_users'));
     } else {
         $depreciation->delete();
         // Redirect to the depreciations management page
         return redirect()->to('admin/settings/depreciations')->with('success', trans('admin/depreciations/message.delete.success'));
     }
 }