小编Kar*_*ers的帖子

如果用户未经批准,则阻止登录 laravel 5.4

我到处检查有关如何检查登录是否批准用户的信息,然后重定向到登录或给出错误。现在我有点困惑,因为在互联网上有很多帖子,每个帖子都不一样。那么任何人都可以帮我解决这个问题吗?解释它是如何工作的(sintaxes和所有其他东西)也非常好

用户.php:

    namespace App;

    use Illuminate\Notifications\Notifiable;
    use Illuminate\Foundation\Auth\User as Authenticatable;

    class User extends Authenticatable
    {
        use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
     protected $fillable = [
    'companyname', 'email', 'password', 'VAT', 'companyphone', 
    'companystreet', 'companycity', 'companycountry', 'companypostcode'
    ];

    /**
    * The attributes that should be hidden for arrays.
    *
 * @var array
 */
protected $hidden = [
    'password', 'remember_token',
];
Run Code Online (Sandbox Code Playgroud)

}

登录控制器:

    namespace App\Http\Controllers\Auth;

    use App\Http\Controllers\Controller;
    use Illuminate\Foundation\Auth\AuthenticatesUsers;

    class LoginController extends Controller
    {
/* …
Run Code Online (Sandbox Code Playgroud)

laravel-5

1
推荐指数
1
解决办法
2293
查看次数

标签 统计

laravel-5 ×1