Replies: 1 comment
-
You could overwrite and change functionality |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
for not yet logged user there is any best why to set the team_id to eager load the roles with user authentication ?
protected $with = ['roles', 'permissions'];
I handle it like this:
`
Route::middleware(['auth:sanctum'])->get('/user', function (Request $request) {
$user = $request->user();
setPermissionsTeamId($user->team_id);
$user->permissions= $user->getPermissionNames();
$user->roles= $user->getRoleNames();
return $user;
});
`
Better way to do this ?
Beta Was this translation helpful? Give feedback.
All reactions