I'm getting the error:
Auth guard [accountant] is not defined.
This is my config\auth.php file
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'admin-api' => [
'driver' => 'token',
'provider' => 'admins',
],
'accountant' => [
'driver' => 'session',
'provider' => 'accountants',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => App\Admin::class,
],
'accountants' => [
'driver' => 'eloquent',
'model' => App\Accountant::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
'admins' => [
'provider' => 'admins',
'table' => 'password_resets',
'expire' => 60,
],
'accountants' => [
'provider' => 'accountants',
'table' => 'password_resets',
'expire' => 60,
],
],
];
The previous guard admin is working fine. But the accountant guard is throwing an error. What have I done incorrectly?
I have added the guard in the model as well
Paul-Beyond
1,7671 gold badge14 silver badges31 bronze badges
1 Answer 1
You may need to clear the config cache:
php artisan config:clear
Here are the docs on configuration caching: https://laravel.com/docs/5.4/configuration#configuration-caching
You may have previously run the config:cache command on your dev instance
answered Jul 1, 2017 at 7:12
kjones
1,4531 gold badge15 silver badges30 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-php
php artisan config:clear?