【发布时间】:2018-06-09 14:48:19
【问题描述】:
我对 Larvel 仍然很陌生,所以我不知道该怎么做: 我卡在登录系统上。我正在尝试了解如何防止非活动用户使用该应用程序。
编辑
对于非活动用户,我的意思是那些记录字段“活动”为 0 的用户。所以我需要执行一个检查来验证邮件和密码以及活动字段
我已经制作了表格和身份验证系统,并且按照文档中的说明,我已经将此方法放在了我的 AuthController 中:
public function authenticate()
{
dd('hi');
}
好吧,它完全被忽略了。似乎它永远不会被触发。我错过了什么吗?
我的控制器看起来像原来的 Laravel 5.2 AuthController 除了之前的方法。没有进行其他更改,因为根据文档没有提到其他更改...
我的测试:
我还搜索了一种称为身份验证的方法。但是没有找到方法(使用phpstorm)。所以我的问题是:
如果它是一个特征,不应该声明那个方法吗?所以我可以通过声明一个同名的方法来覆盖它?
重要文件:
Routes.php
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'HomeController@index');
Route::auth();
Route::get('/home', 'HomeController@index');
【问题讨论】:
标签: php laravel authentication laravel-5 laravel-5.2