Extend user model for Sentry

Submitted by Mahmoud_Zalt - 8 years ago

Using Sentry With Eloquent

It works with me as follow:

1:
go to the sentry config file file (app/config/packages/cartalyst/sentry/config.php)
and make the user model point to the default laravel's user model

'model' => 'User',
// 'model' => 'Cartalyst\Sentry\Users\Eloquent\User',
2: 
then extend the sentry default user like this:

<?php

use Cartalyst\Sentry\Users\Eloquent\User as SentryUserModel;

class User extends SentryUserModel {

    protected $hashableAttributes = array(
        'persist_code',
    );

}

in the above example I am preventing sentry from hashing the password field by overriding the $hashableAtrributes array.