I'm using laravel 8 and laravel breeze for authentication and now want to use guard for authenticating different users like "admin users" and others using different tables (users, admins, so on) or even in a same table and model. how can I do that?
some information:
- I changed LoginRequest:
if (! Auth::guard('admin')->attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
- I created Admin model and it's table.
- I changed auth.php for adding provider and guard
when I try to login, it redirects to login page without any error.