Closed crysaro closed 1 year ago
I haven't checked this but I'm sure you haven't considered section user-providers.
Please use command php spark shield:model UserModel
to create a new model.
If you think you have done the steps correctly, please upload the minimum code so I can check.
An example of correct operation in case of setting public string $userProvider = \App\Models\UserModel::class;
.
This is not a bug. It is the specification of CI4. Read https://codeigniter4.github.io/CodeIgniter4/concepts/factories.html#example
I expected Shield to still use the CodeIgniter\Shield\Models\UserModel which is the value of the $userProvider in the config and not the App\Models\UserModel
You need to use an other name than UserModel
for your User Model.
Thank you for the replies!
PHP Version
8.1.13
CodeIgniter4 Version
4.2.9
Shield Version
v1.0.0-beta.3
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
8.0.31
Did you customize Shield?
No
What happened?
I created a model and named it
UserModel.php
and placed it under the/app/Models/
directory. I wanted to use this model for dealing with non auth transaction like saving user first name and last name or displaying users on a list. I was thinking of creating another model to be used for Shield and call itAuthModel.php
. I left the default value for the$userProvider
in the/app/Config/Auth.php
toCodeIgniter\Shield\Models\UserModel;
When the creating a new user using the register page this error occurs:
Steps to Reproduce
Register for a new account
Expected Output
I am not sure if my thinking is correct but I expected Shield to still use the
CodeIgniter\Shield\Models\UserModel
which is the value of the$userProvider
in the config and not theApp\Models\UserModel
Anything else?
No response