Patrick Maciel Patrick Maciel - 1 year ago 120
PHP Question

Admin Routes (or Prefix Routes) in Laravel 4

How can I create admin specific routes in Laravel 4 (Restfull Controllers):

/admin/users (get - /admin/users/index)
/admin/users/create (get)
/admin/users/store (post)

I want to know:

  • What Files and where I need create theam

  • How I need create the route

Answer Source

In Laravel 4 you can now use prefix:

Route::group(['prefix' => 'admin'], function() {

    Route::get('/', 'AdminController@home');

    Route::get('posts', 'AdminController@showPosts');

    Route::get('another', function() {
        return 'Another routing';

    Route::get('foo', function() {
        return Response::make('BARRRRR', 200);

    Route::get('bazz', function() {
        return View::make('bazztemplate');

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download