Reputation: 1702
I started working with Laravel last week and I'm facing a minor problem with routes.
when i do the following:
Route::group(array('before' => 'auth'), function() {
Route::resource('admin', 'VacatureController');
Route::get('admin/test', array('uses' => 'VacatureController@create'));
Route::post('admin/test', array('uses' => 'VacatureController@store'));
});
and i go to admin/test
, i get an empty page.
when i change admin/test
to something like test/test
like:
Route::group(array('before' => 'auth'), function() {
Route::resource('admin', 'VacatureController');
Route::get('test/test', array('uses' => 'VacatureController@create'));
Route::post('test/test', array('uses' => 'VacatureController@store'));
});
it works fine. I looked itup in the documentation, but i didn't become anything wiser. Can someone please enlighten me?
Upvotes: 0
Views: 41
Reputation: 33186
Try putting the Route::resource
as the last route. Laravel will try all routes in the order you put them in the route file, so when you put the resource route first only this one will be checked because it expects all admin routes to be there.
Route::group(array('before' => 'auth'), function() {
Route::get('admin/test', array('uses' => 'VacatureController@create'));
Route::post('admin/test', array('uses' => 'VacatureController@store'));
Route::resource('admin', 'VacatureController');
});
Upvotes: 2