Reputation: 102
I have those routes
Route::get('/account/{id}','AccountsController@show')->name('account.show');
Route::get('/account/create','AccountsController@create')->name('account.create');
And those methods in my AccountsController
public function show(){
echo 'SHOW';
}
public function create(){
echo 'CREATE';
}
And when I use route account/create it return "SHOW". Any idea why it doesn't go to the correct method ? Thank you.
Upvotes: 1
Views: 369
Reputation: 356
The {id}
part in the first route is a wildcard, so any value will match the first route, number or string. You just need to switch the order of the routes.
Upvotes: 6