Group route does not work on Laravel 5

Asked

Viewed 621 times

-2

Good night guys, all right? I have a problem in Laravel 5 routes. I have a group of routes to the administrative panel of the site (routes with prefix panel) and within the group I want the first page to be exactly "root". See the code below:

Route::group(['prefix' => 'painel', 'namespace' => 'Backend'], function(){

    // Login Routes
    Route::get('/', 'LoginController@getLogin');
]);

This way when access 'localhost/panel' does not open, it appears 404. Already if I put like this:

Route::group(['prefix' => 'painel', 'namespace' => 'Backend'], function(){

    // Login Routes
    Route::get('/teste', 'LoginController@getLogin');
]);

and localhost/dashboard/test access works. I want this route to work when accessing localhost/dashboard only. Someone knows what I’m doing wrong?

Thank you!

  • you could show me what happens when you list the routes: php Artisan route:list

  • But you have two groups? I don’t understand

2 answers

-1

Already tried to create route '/panel' outside the group?

I believe it will work :)

 Route::get('/painel', 'LoginController@getLogin');

It should be before the group in the route file.

-1

Missed the default route within the group, keep both.

// Rota Default
Route::get('/', 'LoginController@getLogin');

// Login Routes
Route::get('/teste', 'LoginController@getLogin');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.