/**
  * 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;
 }
 /**
  * Restore the resource if soft deleted.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function restore($id)
 {
     if (!$this->resource->softDeletes) {
         return abort(405, 'This resource does not allow soft deletes.');
     }
     $model = $this->resource->withTrashed()->find($id);
     Drawbridge::authorize('delete', $model);
     $model->restore();
     return redirect()->route('caravel::' . $this->resource->name . '.index');
 }
 /**
  * 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');
 }