我正在尝试使用具有登录名和admin的usercontroller。我的设置如下:
Dashboard -> Admin
Users -> Overview of users section on admin
login -> Login before admin area
signup -> Signup before admin area
用户控制器位于管理员的“仪表板”文件夹下。该控制器可以控制,查看/添加/编辑/删除用户的任何内容。
但是由于路径不同,我不能在其中使用登录名和sigup。
这是我的route.php的样子:
Router::prefix('dashboard', function ($routes) {
$routes->connect('/', ['controller' => 'Dashboard', 'action' => 'index']);
$routes->prefix('users', function ($routes) {
$routes->connect('/users', ['controller' => 'Users', 'action' => 'index']);
$routes->connect('/users', ['controller' => 'Users', 'action' => 'profile']);
$routes->connect('/users', ['controller' => 'Users', 'action' => 'groups']);
$routes->connect('/groups', ['controller' => 'Groups', 'action' => 'index']);
$routes->connect('/groups/:action/*', ['controller' => 'Groups']);
});
$routes->prefix('sc', function ($routes) {
$routes->connect('/announcements', ['controller' => 'Announcements', 'action' => 'index']);
$routes->connect('/announcements/:action/*', ['controller' => 'Announcements']);
$routes->connect('/push-notifications', ['controller' => 'Push', 'action' => 'index']);
$routes->connect('/settings', ['controller' => 'appsettings', 'action' => 'index']);
});
$routes->prefix('web', function ($routes) {
$routes->connect('/pages', ['controller' => 'web', 'action' => 'pages']);
$routes->connect('/websettings', ['controller' => 'websettings', 'action' => 'index']);
});
$routes->fallbacks(DashedRoute::class);
});
Router::scope('/', function (RouteBuilder $routes) {
$routes->registerMiddleware('csrf', new CsrfProtectionMiddleware([
'httpOnly' => true
]));
$routes->applyMiddleware('csrf');
$routes->connect('/', ['controller' => 'Users', 'action' => 'login', 'home']);
$routes->connect('/signup', ['controller' => 'Users', 'action' => 'signup']);
$routes->fallbacks(DashedRoute::class);
});
因此路径如下:
http://localhost:8765/dashboard/users
http://localhost:8765/users/login
http://localhost:8765/users/signup
我希望最后2个项目是什么
http://localhost:8765/login
http://localhost:8765/signup
据我所知我不能使用2个用户控制器。因此,如何在一个控制器中而不是在路径中与所有用户流一起进行登录/签名,
欢呼