Laravel 4.2 将 Sentinel 与 Jenssegers 一起使用 MongoDB

Laravel 4.2 use Sentinel with Jenssegers MongoDB

是否可以在 Laravel 4.2 上将 Cartalyst/Sentinel 与 Jenssegers/MongoDB 一起使用? 我目前正在使用 Sentry,但我想试用具有新功能的 Sentinel。

安装后,我尝试了这个:

    $user = Sentinel::register([
        'email'              => $email,
        'password'           => $password,
    ]);

但是我遇到了以下错误:

Argument 2 passed to Illuminate\Database\Query\Builder::__construct() must be an instance of Illuminate\Database\Query\Grammars\Grammar, null given, called in /home/vagrant/shared/muzza/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 1853 and defined

Sentinel 没有与 Jenssegers MongoDB 库集成。

Dan Syme commented on 2 Jul:

You would have to write the implementations for the different models used throughout Sentinel.

Then switch out the models for the different entities on the config file with your own implementations, Sentinel should take care of everything else.

Maxime-BHA commented on 3 Jul:

As @jenssegers already did for Sentry package, you have to create your own Models extending the originals models from Sentinel and bind the attributes defined in those models for relationships/persistances to the new models etc.. like static $usersModel = 'Cartalyst\Sentinel\Users\EloquentUser'; and also change the config file.

See exemple for Sentry there : https://github.com/jenssegers/laravel-mongodb-sentry

I think it's the exact same procedure.

您可以找到更多信息 here