Block user

0

I need to create the block user section in an app I'm doing, so I did the following.

1.- Add a new boolean field to the USER table

$table->boolean('isBlocked')->default(0);

2.- Then in the LoginController controller

protected function credentials(Request $request)
{
    $credentials = $request->only($this->username(),'password');
    return array_add($credentials, 'isBlocked', 0); 
}

The problem is that both the user has a value of 0 or 1 in the isBlocked field, the system will not let me enter.

    
asked by Felipe 20.03.2018 в 22:08
source

1 answer

0

That works for verifications > = 5.3 and you would miss it in the model User.php put

public function findForPassport($identifier) {
     return User::orWhere(‘email’, $identifier)->where('isBlocked', 0)->first();
}
    
answered by 22.03.2018 / 17:06
source