Support the ongoing development of Laravel.io →
Database Eloquent Installation
Last updated 2 years ago.
0

I think i found a way :

 public function permissionsForUser($user) {
        return $this->with(['roles.users' => function($q) use ($user) {
            $q->where('users.id', $user->id);
        }])->distinct()->pluck('permissions.name')->all();
    }
0

Sign in to participate in this thread!

Eventy

Your banner here too?

FrancoisH francoish Joined 9 Sep 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.