/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $list = App\RatingList::find($id); $list->items()->detach(); App\RatingList::destroy($id); flash()->success('Success!', '<strong>' . e($list->name) . '</strong> has been destroyed.'); return redirect('/'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($list_id, $item_id) { // Detach the item from the list $list = App\RatingList::find($list_id); $list->items()->detach($item_id); // Create a success notification $item = App\Item::find($item_id); flash()->success('Success!', 'You have removed <strong>' . e($item->name) . '</strong> from your list.'); // Redirect to the lists page return redirect()->action('ListsController@show', $list_id); }