/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $id = $this->route($this->resource->name); if (isset($id)) { Drawbridge::authorize('update', $this->resource->find($id)); } else { Drawbridge::authorize('create', $this->resource->newInstance); } return true; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $model = $this->resource->find($id); Drawbridge::authorize('delete', $model); $model->delete(); session()->flash('success', ucfirst(str_singular($this->resource->name)) . ' was deleted successfully!'); return redirect()->route('caravel::' . $this->resource->name . '.index'); }