/** * User meal update page. * * @return Response */ public function getUpdate(Request $request, $id) { try { return view('meal/update', ['meal' => Meal::findOrFail($id), 'dishes' => Dish::where('user_id', Auth::user()->id)->get()]); } catch (ModelNotFoundException $e) { abort(404, 'Item not found.'); } }
/** * List user dishes. * * @return Response */ public function getList() { $dishes = Dish::where('user_id', '=', Auth::user()->id)->get(); return view('dish/list', ['dishes' => $dishes]); }
public function deleteDish(Request $request) { $dish_id = \StringHelper::filterString($request->input('dish_id')); $deletedRows = Dish::where('dish_id', $dish_id)->delete(); $catRow = \App\DishCategory::where('dish_id', $dish_id)->delete(); return Redirect::back()->with('message', 'Success'); }