![]() |
Shield table auth_identities - fill column name - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34) +--- Thread: Shield table auth_identities - fill column name (/showthread.php?tid=86182) |
Shield table auth_identities - fill column name - groovebird - 01-18-2023 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? RE: Shield table auth_identities - fill column name - kenjis - 01-18-2023 Do you mean you want to add column "name" in the user table? See https://github.com/codeigniter4/shield/discussions/333 RE: Shield table auth_identities - fill column name - groovebird - 01-19-2023 (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/quickstart/#creating-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? RE: Shield table auth_identities - fill column name - InsiteFX - 01-19-2023 @kenjis, I think he needs to add the name field he added to the $allowedFields[] array. RE: Shield table auth_identities - fill column name - groovebird - 01-19-2023 (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 = [ RE: Shield table auth_identities - fill column name - kenjis - 01-19-2023 @groovebird The name column in auth_identities https://github.com/codeigniter4/shield/blob/develop/src/Database/Migrations/2020-12-28-223112_create_auth_tables.php#L37 is the name for the User Identitiy. For example, it is used for an Access Token. See https://codeigniter4.github.io/shield/authentication/#generating-access-tokens You can set it ('Work Laptop' in the sample code) by $user->generateAccessToken(). See also https://codeigniter4.github.io/shield/concepts/#user-identities RE: Shield table auth_identities - fill column name - kenjis - 01-19-2023 If you want to do: PHP Code: $user = new User([ It seems better to add "name" column in "users" table. RE: Shield table auth_identities - fill column name - groovebird - 01-19-2023 @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!! |