Laravel - Sentinel用户与雄辩用户不同

时间:2018-01-25 10:24:17

标签: php laravel sentinel

我正在使用Laravel和Sentinel进行身份验证。

身份验证工作正常,我可以使用Sentinel登录并返回用户,我可以看到所有用户的字段。

但是,我无法访问它的关系(Sentinel角色除外)。

$user = Sentinel::findById($userId);
dd($user->telephones); // returns null

$user = App\User::find($userId);
dd($user->telephones); // displays a dump of the associated eloquent collection

有没有办法从Sentinel检索雄辩的用户,以便我可以查看它的关系?

1 个答案:

答案 0 :(得分:2)

User模型中扩展Sentinel EloquentUser

class User extends EloquentUser

在您的catalyst sentinel config设置用户模型中,如

'users' => [
    'model' => 'App\User',
],

别忘了跑 -

php artisan config:clear