public function deleteCollection($id) { if (Request::ajax()) { $arrReturn = ['status' => 'error', 'message' => 'Please refresh and try again.']; try { $collection = Collection::findorFail($id); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { return App::abort(404); } $name = $collection->name; if ($collection->delete()) { $arrReturn = ['status' => 'ok', 'message' => "Collection <b>{$name}</b> has been deleted."]; } $response = Response::json($arrReturn); $response->header('Content-Type', 'application/json'); return $response; } return App::abort(404); }