app/Http/Controllers/MealController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Meal  $meal
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Meal $meal)
    {
        $validated = $request->validate([
            'name' => 'required|max:100',
            'description' => 'required|max:255',
            'price' => 'required|numeric'
        ]);
        $meal->update([
            "name" => $validated["name"],
            "description" => $validated["description"],
            "price" => $validated["price"]
        ]);
        return redirect(route("menu.index"));
    }
public function update ( Request $ request , Meal $ meal ) { $ validated = $ request -> validate ( [ 'name' => 'required|max:100' , 'description' => 'required|max:255' , 'price' => 'required|numeric' ] ) ; $ meal -> update ( [ " name " => $ validated [ " name " ] , " description " => $ validated [ " description " ] , " price " => $ validated [ " price " ] ] ) ; return redirect ( route ( " menu.index " ) ) ; }
Update the specified resource in storage.
Update the specified resource in storage .