Shield table auth_identities - fill column name |
Hi,
how can i fill the column "name" if a new user will be registered or updated? I added the column in the array of user data but the column will not be filled. How can i solve this?
Do you mean you want to add column "name" in the user table?
See https://github.com/codeigniter4/shield/discussions/333
(01-18-2023, 06:01 PM)kenjis Wrote: Do you mean you want to add column "name" in the user table? No. The table auth_identites already has a column with the name of "name". After executing the migration this column exists. I add a user like this: https://codeigniter4.github.io/shield/qu...ting-users With the following modification i wanted to fill this already existing column: PHP Code: $user = new User([ But the column "name" is still NULL. How can i fil this column?
(01-19-2023, 12:23 AM)InsiteFX Wrote: @kenjis, I think he needs to add the name field he added to the $allowedFields[] array. @InsiteFX, the field is already there. This is the code from the UserIdentityModel: PHP Code: protected $allowedFields = [
@groovebird
The name column in auth_identities https://github.com/codeigniter4/shield/b...es.php#L37 is the name for the User Identitiy. For example, it is used for an Access Token. See https://codeigniter4.github.io/shield/au...ess-tokens You can set it ('Work Laptop' in the sample code) by $user->generateAccessToken(). See also https://codeigniter4.github.io/shield/co...identities
If you want to do:
PHP Code: $user = new User([ It seems better to add "name" column in "users" table.
01-19-2023, 01:56 AM
(This post was last modified: 01-19-2023, 02:01 AM by groovebird. Edit Reason: Question already answered above )
@kenjis ah ok.
Does it mean this is not really the column i can use for a name if not using the tokens? Do i have to add another column as you recommended in your first post? EDIT: now i see you already answered to my question :-) Thank you!! |
Welcome Guest, Not a member yet? Register Sign In |