0👍
You can check if the $customer
variable is null
before accessing its status property.
if (!$customer || $customer->status !== CustomerStatus::Active->value) {
// handle disabled account
}
- [Vuejs]-How does vue v-if handle memory?
- [Vuejs]-Laravel and Vue in WAMP — components don't compile, just appear as their component names
-2👍
public function authenticate()
{
$this->ensureIsNotRateLimited();
if (!Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
$user = $this->user();
$customer = $user->customer;
if ($customer->status !== CustomerStatus::Active->value && $customer->status != null) {
/*the problem is here*/
Auth::guard('web')->logout();
$this->session()->invalidate();
$this->session()->regenerateToken();
throw ValidationException::withMessages([
'email' => 'Your account has been disabled',
]);
}
RateLimiter::clear($this->throttleKey());
}
Source:stackexchange.com