简体   繁体   中英

Laravel method not allowed exception

I can't seem to find out why does my submit give me back the MethodNotAllowedException . Shortened...here is the form:

<form role="form" id="tryitForm" class="form-horizontal" enctype="multipart/form-data" 
      method="POST" action="{{route('user.update', Auth::user()->id)}}">

<input type="submit" class="btn btn-primary" name="save" value="Update"/>

And I have route set up as:

Route::resource('user', 'UserController');

You need to add PUT method into your form.

 <input name="_method" value="PUT" type="hidden">
 <input type="hidden" value="{{ csrf_token() }}" name="_token">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM