Update # 1
So, I think I found out where the problem is, but since I lack knowledge, I cannot solve it.
When using Sentry, I tried to expand both the Model parameters, which is used by Sentry and Laravel's Eloquent package by default Illuminate\Database\Eloquent\Model. Nothing worked. But when using Laravel Eloquent on its own (without the Sentry add-on packages), Stapler works beautifully.
So, I think that there is a compatibility problem between the Stapler model and Sentry User, even if it uses Eloquent (its additional functions may contradict the attributes of a stapler or build function, I do not know). Too bad, since Sentry is a great authentication and throttling package and is widely used as far as I know.
Is there any easy way to use the statistical version of the stapler with a sentinel or do I have to rewrite all my code to use laravel auth?
Main question
I am creating an application that uses Cartalyst Sentry to manage users. However, I want users and other models to have associated avatars, so I also use the Codesleeve Stapler.
laravel-stapler readme, stapler, , Sentry. , :
$user = Sentry::createUser(array(
'username' => Input::get('username'),
'email' => Input::get('email'),
'password' => Input::get('password'),
'activated' => false,
'avatar' => Input::file('avatar')
));
return 'success';
:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'avatar' in 'field list'
, , Sentry , , Stapler .
Sentry ( Laravel's):
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Illuminate\Database\Eloquent\Model;
use Codesleeve\Stapler\ORM\StaplerableInterface;
use Codesleeve\Stapler\ORM\EloquentTrait;
use Cartalyst\Sentry\Groups\GroupInterface;
use Cartalyst\Sentry\Hashing\HasherInterface;
use Cartalyst\Sentry\Users\LoginRequiredException;
use Cartalyst\Sentry\Users\PasswordRequiredException;
use Cartalyst\Sentry\Users\UserAlreadyActivatedException;
use Cartalyst\Sentry\Users\UserExistsException;
use Cartalyst\Sentry\Users\UserInterface;
class User extends Model implements UserInterface, StaplerableInterface {
use SoftDeletingTrait, EloquentTrait;
protected $fillabe = array('username','email','password','password_temp','code','active','avatar');
public function __construct(array $attributes = array()) {
$this->hasAttachedFile('avatar', [
'styles' => [
'medium' => '300x300',
'thumb' => '100x100'
]
]);
parent::__construct($attributes);
}
protected $dates = ['deleted_at'];
Sentry:
'model' => 'Cartalyst\Sentry\Users\Eloquent\User',
, Laravel, Sentry Stapler, , .
!