Using custom users table and provider #8125
-
Something strange is happening and I can't wrap my head around it. 😭 I have been trying to setup Statamic to store users in the database without luck. This is an existing Laravel app and I am trying to use a separate users table from the existing one. Here is my Note I have successfully created the Users and other tables (as I am using the eloquent driver for storing content in the DB). 'guards' => [
//..
'statamic' => [
'driver' => 'session',
'provider' => 'statamic',
]
],
'providers' => [
//...
'statamic' => [
'driver' => 'statamic',
],
],
'passwords' => [
//...
'activations' => [
'provider' => 'statamic',
'table' => 'password_activations',
'expire' => 4320,
'throttle' => 60,
],
], Here is the [
'repository' => 'eloquent',
'repositories' => [
'file' => [
'driver' => 'file',
'paths' => [
'users' => base_path('users'),
'roles' => resource_path('users/roles.yaml'),
'groups' => resource_path('users/groups.yaml'),
],
],
'eloquent' => [
'driver' => 'eloquent',
],
],
'database' => env('STATAMIC_ELOQUENT_CONNECTION'), // Maybe this is the problem?
'tables' => [
'users' => 'users',
'role_user' => 'role_user',
'group_user' => 'group_user',
],
'guards' => [
'cp' => 'statamic',
'web' => 'statamic',
],
] The Finally, this is the error I get when I try to login or create a new user, config modal is null:
Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, I encountered the same issue and found a workaround. I included the following guard in the
I also added the subsequent provider to the
Furthermore, I created a custom model for the table which extends the The only modification I made was to the CP authentication guard in the I hope this solution will work for others as well. |
Beta Was this translation helpful? Give feedback.
Hi, I encountered the same issue and found a workaround.
I included the following guard in the
auth.php
:I also added the subsequent provider to the
auth.php
:Furthermore, I created a custom model for the table which extends the
Illuminate\Foundation\Auth\User
.The only modification I made was to the CP authentication guard in the
config/statamic/users.php
, setting it tostatamic
.I hope this solution will work for others as well.