Skip to content

Instantly share code, notes, and snippets.

@fedeisas
Created June 26, 2013 20:51
Show Gist options
  • Save fedeisas/5871546 to your computer and use it in GitHub Desktop.
Save fedeisas/5871546 to your computer and use it in GitHub Desktop.
Extending Sentry User Class
<?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
));
Copy link

ghost commented Sep 7, 2013

Did you manage to solve this? I am having the same problem right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment