Support the ongoing development of Laravel.io →
posted 9 years ago
Requests
Last updated 2 years ago.
0

The routes.php file should always be there.
In order to add new route files you could do the following:

  1. edit the file app/start/global.php
  2. add new route files:
  • require app_path().'/routes/users.php';
  • require app_path().'/routes/users.php';
Last updated 2 years ago.
0

You can do this by including your route file in app/Providers/RouteServiceProvider.php. Assuming your all routes file in app\Http\Routes directory. put your admin.php file in

  • app/Http/Routes/admin.php

Now resister this route file in map method of RouteServiceProvider.php .

public function map(Router $router)
{
    // Authentication
    $router->group(['namespace' => $this->namespace], function($router)
    {
        require app_path('Http/routes.php');

        //custom route file here
        require app_path('Http/Routes/admin.php');
    });
}
Last updated 8 years ago.
0

Here I have build a package to manage laravel routes. You may check this https://packagist.org/packages/thedevsaddam/multiple_route

0

With Laravel 5.2, you can do it with this way:

  1. Create your router file in "app/Http" directory
    ex: "app/Http/my_route.php"
  2. Open file "app/Providers/RouteServiceProvider.php"
  • Looking for method "mapWebRoutes(Router $router)" at the end of this class
  • Add a statement like this: " require app_path('Http/my_route.php'); "
    Now you can enjoy your new router file. Have fun!
Last updated 8 years ago.
0

I wonder how you can do this Laravel 5.3?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Donny5300 donny5300 Joined 3 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.