我正在使用Laravel和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有没有办法从哨兵那里检索出有口才的用户,这样我就可以了解它的关系了吗?
发布于 2018-01-25 10:33:49
在您的User模型中,扩展哨兵EloquentUser。
class User extends EloquentUser在您的catalyst sentinel config集合中,用户模型如下-
'users' => [
'model' => 'App\User',
],别忘了跑-
php artisan config:clearhttps://stackoverflow.com/questions/48440577
复制相似问题