I am trying to learn more about Cartalyst Sentinel in Slim PHP for user sign up and authentication. I'm a bit out of my depth as I've not attempted this type of thing in the past.
I have been following this tutorial on how to implement Sentinel in Slim:
Removing the Pain of User Authenticaion With Sentinel
I have everything working as explained, however now I want to start changing things a little to require additional data captured at the sign-up process; a username, date of birth, country selection.
I have added the additional columns in the users table, and added the required form fields and updated the code in the controller:
$user = $app->container->sentinel->create([
'first_name' => $data['firstname'],
'last_name' => $data['lastname'],
'username' => $data['username'],
'dob' => $data['dob'],
'country' => $data['country'],
'email' => $data['email'],
'password' => $data['password'],
'permissions' => [
'user.delete' => false,
],
]);
However no additional data is stored in the database table. From some further reading on the below link by Naomi Aro it seems like I need to update the the Users Model, which I've done, but dont believe I've done correctly!
Multiple Login Attributes with Sentinel and Laravel
namespace app\models\Users;
use Cartalyst\Sentinel\Users\EloquentUser as SentinelUser;
class Users extends SentinelUser
protected $fillable = [
'email',
'username',
'dob',
'country',
'password',
'last_name',
'first_name',
'permissions',
];
protected $loginNames = ['email', 'username'];
I've required my model in the index.php file but it doesnt seem to be picked up, so I assume I'm not implementing it correctly with Sentinel?
$app = new \Slim\Slim(array(
'users' => [
'model' => 'app/models/Users',
]
));
I also found this post which deals with the same issue, but is Laravel specific.
Laravel Cartalyst Sentinel - Adding a username column to users table (What is the right way)
I'm not sure how to proceed, does anyone have any idea or suggestions?
Thank you!!