我需要用户配置控制子路径
你好。
实施例
Route.php
Route::group(['prefix' => '/{user}'], function () {
Route::group(['prefix' => '/map'], function () { require app_path('map.route.php'); });
Route::group(['prefix' => '/contact'], function () { require app_path('contact.route.php'); });
Route::group(['prefix'=>'/'], function(){
$user = \App\User::find($user);
if( $user -> first_page )
{
require app_path($user -> first_page.'.route.php');
}
});
});
非常感谢。
答案 0 :(得分:1)
我可能在这里错了,但是这个怎么样(我在函数中添加了$ user)
Route::group(['prefix' => '/{user}'], function ($user) {
Route::group(['prefix' => '/map'], function () { require app_path('map.route.php'); });
Route::group(['prefix' => '/contact'], function () { require app_path('contact.route.php'); });
Route::group(['prefix'=>'/'], function($user){
$user = \App\User::find($user);
if( $user -> first_page )
{
require app_path($user -> first_page.'.route.php');
}
});
});