Flarum\Core\User::permissions PHP Method

permissions() public method

Define the relationship with the permissions of all of the groups that the user is in.
public permissions ( ) : Builder
return Illuminate\Database\Eloquent\Builder
    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_activated) {
            $groupIds = array_merge($groupIds, [Group::MEMBER_ID], $this->groups->lists('id')->all());
        }
        event(new PrepareUserGroups($this, $groupIds));
        return Permission::whereIn('group_id', $groupIds);
    }