1

I am new in laravel 5.2. I want to make dashboard for admin but i do not understand how to make it. I did copy all controller files in admin folder and also copied view folder in admin folder.

I did try some code which is mention below:-

Route::group(array('namespace'=>'Admin'), function()
{
  Route::get('/admin', array('as' => 'admin', 'uses' =>  'UserController@index'));
  Route::get('/admin/register', array('as' => 'register', 'uses' =>  'UserController@register'));
  Route::get('/admin/login', array('as' => 'login', 'uses' =>  'UserController@login'));

});

but now I want to show all controller files under admin like:-

localhost:8000/admin/users
Varinder
  • 202
  • 5
  • 16

1 Answers1

0

If you want to use all route of admin on localhost:8000/admin. You should use route group and add prefix on it, like that

Route::group(['prefix' => 'admin/'], function () {
  Route::get('users', function ()    {
    // Matches The "/admin/users" URL
  });

  Route::get('login', function ()    {
    // Matches The "/admin/login" URL
  });
  .......
});

Read more at this doc https://laravel.com/docs/5.2/routing#route-groups

I hope this could help you.

Henry Bui
  • 423
  • 3
  • 17