我有一個問題得到了stucked。爲路由創建文件夾併爲不同的路由定義不同的文件。像我有3種類型的用戶。 admin,user1,user2。我想爲路線創建3個不同的子文件夾。我seacrh谷歌和實施這一點。但它不起作用。 任何人都可以幫助我。laravel中的多路徑文件5 /多個路徑文件夾
感謝
<?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();
}
});
}
}
你所說的「文件夾」是什麼意思?您想要將路線保存在單獨的文件/文件夾中?你想單獨的「文件夾」的網址? –