I have Getting stucked with one problem. creating the folder for routes and define the different file for different route. like i have 3 type of user. admin , user1,user2. i want to create 3 different subfolder for routes. i seacrh google and implement this. but its is not working. anyone help me.
thanks
<?php namespace App\Providers;
use Illuminate\Routing\Router;
use File;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider {
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
parent::boot($router);
//
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function($router)
{
foreach(File::allFiles(app_path().'/Http/Routes') as $route) {
require_once $route->getPathname();
}
});
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire