Reputation: 169
I want to update a form with the @method('put')
<form method="POST" action="{{ route("admin.experiences.update", [$experience->id]) }}"
enctype="multipart/form-data">
@method('put')
@csrf
but a have this messageError:
The PUT method is not supported for this route. Supported methods: GET, HEAD, POST
So i have used the same methode for the other form and it's worked nice.
The routes:
Route::delete('experiences/destroy', 'ExperiencesController@massDestroy')-
>name('experiences.massDestroy');
Route::resource('experiences', 'ExperiencesController');
The controller:
public function update(UpdateExperienceRequest $request, Experience $experience)
{
$experience->update($request->all());
return back()->with('success','Expérience modifiée avec succès!');
}
public function edit(Organigramme $organigramme, Experience $experience)
{
//
}
Need a help Thanks in advance!
Upvotes: 0
Views: 164
Reputation: 2834
Use this:
<form method="POST" action="{{route("experiences.update", ['id' => $experience->id]) }}"
enctype="multipart/form-data">
@method('put')
@csrf
</form>
Upvotes: 1