Ejemplo n.º 1
0
 /**
  * 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.');
     }
 }
Ejemplo n.º 2
0
 /**
  * List user dishes.
  *
  * @return Response
  */
 public function getList()
 {
     $dishes = Dish::where('user_id', '=', Auth::user()->id)->get();
     return view('dish/list', ['dishes' => $dishes]);
 }
Ejemplo n.º 3
0
 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');
 }