Reputation: 6713
I'm trying to save a backbone model using model.save().
The url I'm trying to send a POST method to is: http://localhost/user
My route is: Route::POST('/user/{user}', 'Dashboard\Dashboard@newUser');
But I get a Method Not Allowed Exception
Can you see what's wrong in my code?
Upvotes: 0
Views: 958
Reputation: 27295
And you should look at case sensitivity when you look at the documentation.
Route::post('foo/bar', function () {
return 'Hello World';
});
Its lowercase. Sometimes that can cause problems.
The next thing is that "named routes" looks like the following:
Route::get('user/profile', [
'as' => 'profile', 'uses' => 'UserController@showProfile'
]);
I haven't tried that in your way but in that way its working.
And the last thing is that you should pass an ID to your route otherwise the route is not correct. in your case /user/1
for example.
https://laravel.com/docs/5.1/routing
Upvotes: 2