Reputation: 79
My button URL is : <a href="{{url('cvs/create')}}" class="btn btn-success"> Nouveau Cv</a>
It redirects me to : http://localhost:8000/cvs/create
, normal.
But my page is in reality : Route::get('/cvs/{id}', 'InfosController@indexe');
where I can visualize information about any CV
Why is that happening?
Here is a list of all my routes:
Route::post('/infos', 'InfosController@store');
Route::get('/cvs/{id}', 'InfosController@indexe');
Route::get('/cvs','CVController@index');
Route::get('/cvs/create','CVController@create');
Route::post('/cvs','CVController@store');
Route::get('/cvs/{id}/edit','CVController@edit');
Route::put('/cvs/{id}','CVController@update');
Route::delete('/cvs/{id}','CVController@destroy');
Upvotes: 1
Views: 59
Reputation: 336
You probably just need to move
Route::get('/cvs/create','CVController@create')
above
Route::get('/cvs/{id}', 'InfosController@indexe')
The routes are processed top-down, so when Laravel sees
'/cvs/create'
it's matching the
'cvs/{id}'
route and sending the request to 'InfosController@index. It never gets to your intended route.
Hope that helps!
Upvotes: 4