I am getting a MethodNotAllowedException
when trying to submit my form. Here are my routes
Route::group(['middleware' => 'auth', 'prefix' => 'admin'], function () {
Route::resource('user', 'UserController');
Route::get('user/destroyMe/{destroyMe}', ['as' => 'user.destroyMe', 'uses' => 'UserController@destroyMe']);
Route::get('user/changeState/{id}', ['as' => 'user.changeState', 'uses' => 'UserController@changeState']);
});
And here is the form part with storing the new user:
<div class="position-center">
<form role="form" id="tryitForm" class="form-horizontal" enctype="multipart/form-data"
method="POST" action="{{route('user.store')}}">
{!! Form::token() !!}
I've checked within route:list
and I clearly have the user.store
named route, and method on the route is POST
. I can't figure out why am I getting the exception?
EDIT
I do have an AdminLTE for Laravel installed Link, but I've overriden its routes. Needles to say that every other route works.
EDIT 2
I tried making a manual route:
Route::post('admin/user', 'UserController@store');
and posting it to the url('admin/user')
but still the same result?
EDIT 3
Clearing the cache didn't help also.
EDIT 4
After further inspection, when hitting a random route which doesn't exist, I get an error header that Sorry, the page you are looking for could not be found.
, but if I do any of the POST
routes, I get Whoops, looks like something went wrong.
(both errors trigger the same exception though).
Laravel log is empty
I have found an error causing all the trouble. Inside my form there was a line
<input name="_method" value="PUT" type="hidden">
It sneaked there by copy/pasting my edit
code