/** * Remove the specified book resource from storage. * * @param Book $book App\Book model * * @return \Illuminate\Http\Response */ public function destroy(Book $book) { $book->delete(); return redirect()->action('BooksController@index')->withSuccess("Książka \"{$book->title}\" została usunięta"); }
/** * Destroy the given book. * * @param Request $request * @param Order $book * @return Response */ public function destroy(Request $request, Book $book) { if (\Auth::id() == $book->user_id) { $book->delete(); } else { \Session::flash('message', 'You are not authorited to do this action!'); \Session::flash('alert-class', 'alert-danger'); } return redirect('/books'); }