src/User/User.php
public function permissions()
    {
        $groupIds = [Group::GUEST_ID];

        // If a user's account hasn't been activated, they are essentially no
        // more than a guest. If they are activated, we can give them the
        // standard 'member' group, as well as any other groups they've been
        // assigned to.
        if ($this->is_email_confirmed) {
            $groupIds = array_merge($groupIds, [Group::MEMBER_ID], $this->groups->pluck('id')->all());
        }

        event(new PrepareUserGroups($this, $groupIds));

        return Permission::whereIn('group_id', $groupIds);
    }
public function permissions()
    {
        $groupIds = [Group::GUEST_ID];

        // If a user's account hasn't been activated, they are essentially no
        // more than a guest. If they are activated, we can give them the
        // standard 'member' group, as well as any other groups they've been
        // assigned to.
        if ($this->is_email_confirmed) {
            $groupIds = array_merge($groupIds, [Group::MEMBER_ID], $this->groups->pluck('id')->all());
        }

        event(new PrepareUserGroups($this, $groupIds));

        return Permission::whereIn('group_id', $groupIds);
    }
public function permissions ( ) { $ groupIds = [ Group :: GUEST_ID ] ; // If a user's account hasn't been activated, they are essentially no // more than a guest. If they are activated, we can give them the // standard 'member' group, as well as any other groups they've been // assigned to. if ( $ this -> is_email_confirmed ) { $ groupIds = array_merge ( $ groupIds , [ Group :: MEMBER_ID ] , $ this -> groups -> pluck ( 'id' ) -> all ( ) ) ; } event ( new PrepareUserGroups ( $ this , $ groupIds ) ) ; return Permission :: whereIn ( 'group_id' , $ groupIds ) ; }
Define the relationship with the permissions of all of the groups that
the user is in.

@return \Illuminate\Database\Eloquent\Builder
Define the relationship with the permissions of all of the groups that the user is in .