Created
June 26, 2013 20:51
-
-
Save fedeisas/5871546 to your computer and use it in GitHub Desktop.
Extending Sentry User Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In /app/models/User.php | |
use Cartalyst\Sentry\Users\Eloquent\User as SentryUserModel; | |
class User extends SentryUserModel {} | |
// In /app/config/packages/cartalyst/sentry/config.php *Omited some parts for brevity | |
return array( | |
'users' => array( | |
/* | |
|-------------------------------------------------------------------------- | |
| Model | |
|-------------------------------------------------------------------------- | |
| | |
| When using the "eloquent" driver, we need to know which | |
| Eloquent models should be used throughout Sentry. | |
| | |
*/ | |
// 'model' => 'Cartalyst\Sentry\Users\Eloquent\User', | |
'model' => 'User', | |
) | |
); | |
// In my AuthController | |
// THIS WORKS | |
$user = Sentry::getUserProvider()->create(array( | |
'email' => Input::get('email'), | |
'name' => Input::get('name'), | |
'password' => Input::get('password'), | |
'activated' => 1 | |
)); | |
// THIS DOESN'T and throws new \RuntimeException("A hasher has not been provided for the user."); | |
$user = User::create(array( | |
'email' => Input::get('email'), | |
'name' => Input::get('name'), | |
'password' => Input::get('password'), | |
'activated' => 1 | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you manage to solve this? I am having the same problem right now.