'Missing required parameter for [Route: Oeuvre.update]

My update function in the resource controller
public function update(UpdateOeuvreRequest $request, Oeuvre $oeuvre)
{
$oeuvre->titre = $request->input('titre');
$oeuvre->auteur = $request->input('auteur');
$oeuvre->annee = $request->input('annee');
$oeuvre->description = $request->input('description');
$oeuvre->category_id = $request->input('category_id');
$oeuvre->qt = $request->input('qt');
$query=$oeuvre->save();
if($query){
return redirect()->route('Oeuvre')->with('success','updated successfuly');
}
}
MY edit.blade.php
<form action="{{ route('Oeuvre.update',$oeuvre) }}" enctype="multipart/form-data" method="POST">
@csrf
@method('PUT')
<div class="row mb-3">
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" value="{{$oeuvre->titre}}" name="titre" type="text" placeholder="titre" />
<label for="titre">Titre</label>
</div>
</div>
<div class="col-md-6">
<div class="form-floating">
<input class="form-control" value="{{$oeuvre->auteur}}" name="auteur" type="text" placeholder="auteur" />
<label for="auteur">Auteur</label>
</div>
</div>
Solution 1:[1]
I think what is happening is that you are using this parameter in your controller => $oeuvre
Then you have to pass it also through your form and route
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alya Al Siyabi |
