Skip to content

Instantly share code, notes, and snippets.

@csalajan
Created April 23, 2014 23:42
Show Gist options
  • Save csalajan/11236378 to your computer and use it in GitHub Desktop.
Save csalajan/11236378 to your computer and use it in GitHub Desktop.
Delete Function
public function postDelete(){
$id = Input::get('id');
try{
$equipment = Equipment::findOrFail($id);
$equipment -> delete();
}
catch(Exception $e){
//return Response::json(array('status' => 400, 'message' => 'equipment not found', 'error' => $e), 400);
return Redirect::to('inventory/equipment')->with(array('status' => 201, 'message' => 'Failed to Delete Equipment', 'error' => $e));
}
//return Response::json(array('status' => 201, 'message' => 'equipment deleted'), 201);
return Redirect::to('inventory/equipment')->with(array('status' => 201, 'message' => 'Equipment Deleted Successfully'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment