Skip to content
Discussion options

You must be logged in to vote

Here's how I got it to show:

app/Models/User.php

// ...
use DB;
use Statamic\Auth\Role;
use Statamic\Auth\UserGroup;

    // ...

    public function getRolesAttribute()
    {
        $roles = DB::table('role_user')
            ->where('user_id', $this->id)
            ->get()
            ->transform(function ($roleUser) {
                return $roleUser->role_id;
            });

        $groupRoles = $this->statamic_groups->reduce(function ($roles, $group) {
            return $roles->concat($group->roles()->keys());
        }, collect());

        return $roles->concat($groupRoles)->unique();
    }

    public function getStatamicRolesAttribute()
    {
        return $this->roles->tra…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by HazemMohamed252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants