paginate($request->input("limit", 20)); return Response::detect("menuplans.index", [ "menuPlans" => $menuPlans]); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return Response::detect("menuplans.create"); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $requestMenuPlanCreate = $request->validate([ "monday" => "required|max:255", "tuesday" => "required|max:255", "wednesday" => "required|max:255", "thursday" => "required|max:255", "friday" => "required|max:255", "saturday" => "required|max:255", "sunday" => "required|max:255" ]); $menuPlans = new MenuPlan($requestMenuPlanCreate); $menuPlans->save(); return Response::detect("menuplans.store"); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(MenuPlan $id) { return Response::detect("menuplans.show", [ "menuplan" => $id]); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $menuplan = MenuPlan::find($id); return Response::detect("menuplans.edit", ["menuplan" => $menuplan]); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $data = $request->all(); $menuplan = MenuPlan::find($id); $menuplan->update($data); $menuplan->save(); return Response::detect("menuplans.update", [ "menuplan" => $menuplan ]); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $menuplan = MenuPlan::find($id); $menuplan->delete(); return redirect()->route("menu-plans.index"); } }