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', '<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9fcc1c9dccbd0dcd7dadccafad6d7cdcbd6d5d5dccbf9d4d8cacafddccacdcbd6c0">[email protected]</a>')- >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!
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Use this:
<form method="POST" action="{{route("experiences.update", ['id' => $experience->id]) }}" enctype="multipart/form-data"> @method('put') @csrf </form>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0