Laravel 5.2:auth路由在哪里宣布?

时间:2016-02-14 21:46:13

标签: laravel laravel-5.2

我需要重新安排auth系统使用的网址。 Laravel 5.2。 我使用了artisan make:auth,现在我找不到路由器被告知如何使用/login/logout。恕我直言,在我看来,在“易用性”方面倒退了一步,Laravel努力争取在最近的修订中如此模糊,以至于很多被忽视的特征应该变得模糊不清。

我将应用程序划分为管理员和公共区域,并且每个都有单独的登录机制:/ admin / login由核心Laravel系统处理,/ login将用于前端管理员用户, auth由一组不同的类处理。

有人可以告诉我吗?

3 个答案:

答案 0 :(得分:4)

SELECT * FROM @Parts P WHERE NOT EXISTS (SELECT S.sid FROM @Suppliers S WHERE EXISTS (SELECT 1 FROM @Catalog C WHERE s.sid = C.sid AND P.pid = C.pid ) ) 将以下行添加到您的路线文件中:

php artisan make:auth

Route::group(['middleware' => 'web'], function () { Route::auth(); } 是定义以下路线的快捷方式:

Route::auth()

因此,假设您运行了// Authentication Routes... $this->get('login', 'Auth\AuthController@showLoginForm'); $this->post('login', 'Auth\AuthController@login'); $this->get('logout', 'Auth\AuthController@logout'); // Registration Routes... $this->get('register', 'Auth\AuthController@showRegistrationForm'); $this->post('register', 'Auth\AuthController@register'); // Password Reset Routes... $this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm'); $this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail'); $this->post('password/reset', 'Auth\PasswordController@reset'); 并且没有触及任何内容,那么这些将是您可以使用的路线。

来源:https://mattstauffer.co/blog/the-auth-scaffold-in-laravel-5-2#routeauth

答案 1 :(得分:2)

您需要的是构建两个系统,一个用于公共,一个用于管理。

Jeffrey Way(Laracast)制作了一段视频,解释了构建完整的自定义登录系统所需的一切,该系统与artisan make:auth相同。

视频链接为https://laracasts.com/lessons/email-verification-in-laravel。该视频不是免费的,但Jeffrey在此git上提供了代码(https://github.com/laracasts/Email-Verification-In-Laravel)。

我用它来构建两个使用相同数据库的独立系统。

注意:该链接在Laravel中称为电子邮件验证,但它涵盖了用于身份验证的所有内容。

答案 2 :(得分:0)

您只需更改路径的两个参数。

protected $redirectPath = '/dashboard';

当用户成功通过身份验证后,他们将被重定向到此路径。

第二个是登录路径。您可以通过在AuthController上定义loginPath属性来自定义失败的验证后重定向位置:

protected $loginPath = '/login';
相关问题