Reputation: 21
Im new to Laravel and just ran into a problem. I got these two routes.
Route::get('posts/{id}', 'PostController@show'); // To show the post
Route::resource('users', 'UserController');
The problem is when i want to go to /posts/create tries to send me to the show function, but ofcourse can find the object. What am i doing wrong? So i thinks the word "create" is an id.
Hope you can help me out.
Upvotes: 2
Views: 67
Reputation: 8663
Right now you do not have RESTful path binded to correct route. I recommend you to define posts also as resource like this
Route::resource('posts', 'PostController');
Now you have all the RESTful paths automatically created and calling /posts/create will be handled by the create method in controller.
Upvotes: 1