Shield custom field - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Shield custom field (/showthread.php?tid=89020) |
Shield custom field - elbambolo - 12-22-2023 Hello, in codeigniter 4. I'm using the codeigniter shield authorization and login system. I'm trying, following the official guide, to insert a custom user field. there is probably some step that wasn't clear to me or that I didn't perform correctly, because when I register a new user, the new custom field is not stored in the user table. here my code. the custom field name are "cellulare" I'm sure I'm missing a step, but I can't figure out which one. Thanks to everyone who will help me understand the problem. migration: PHP Code: <?php RE: Shield custom field - kenjis - 12-22-2023 This step? https://github.com/codeigniter4/shield/blob/develop/docs/customization/user_provider.md#configuring-to-use-your-usermodel RE: Shield custom field - elbambolo - 12-25-2023 (12-22-2023, 06:39 PM)kenjis Wrote: This step?Yes, i followed this step. i have named the field: cellulare is the only field. i have insert my usermodel. it is wrong? RE: Shield custom field - kenjis - 12-25-2023 My question was that did you do update the $userProvider in app/Config/Auth.php? https://github.com/codeigniter4/shield/blob/develop/docs/customization/user_provider.md#configuring-to-use-your-usermodel If you did it, I don't know what's wrong with you. RE: Shield custom field - elbambolo - 12-27-2023 (12-25-2023, 05:03 PM)kenjis Wrote: My question was that did you do update the $userProvider in app/Config/Auth.php?dho! yes, but in the wrong way... I followed the guide step by step. I then called the Model, UserModel.php when I came to edit the auth.php file I noticed that the directive was present: public string $userProvider = UserModel::class; I assumed that php spark not only created the UserMode.php file, but also put it in $UserProvider. After reading your answer, I changed the variable to: public string $userProvider = \App\Models\UserModel::class; by entering the full path to the file created by php spark now it works perfectly. Thank you! RE: Shield custom field - kenjis - 12-27-2023 Okay, good! The official documentation has been updated: https://shield.codeigniter.com/customization/user_provider/ |