class BooksController extends Controller
abort_unless(\Gate::allows('book_access'), 403);
return view('admin.books.index', compact('books'));
abort_unless(\Gate::allows('book_create'), 403);
return view('admin.books.create');
public function store(StoreBookRequest $request)
abort_unless(\Gate::allows('book_create'), 403);
$book = Book::create($request->all());
return redirect()->route('admin.books.index');
public function edit(Book $book)
abort_unless(\Gate::allows('book_edit'), 403);
return view('admin.books.edit', compact('book'));
public function update(UpdateBookRequest $request, Book $book)
abort_unless(\Gate::allows('book_edit'), 403);
$book->update($request->all());
return redirect()->route('admin.books.index');
public function show(Book $book)
abort_unless(\Gate::allows('book_show'), 403);
return view('admin.books.show', compact('book'));
public function destroy(Book $book)
abort_unless(\Gate::allows('book_delete'), 403);