public function getAllPermissions(): Collection
    {
        $permissions = $this->permissions;

        if ($this->roles) {
            $permissions = $permissions->merge($this->getPermissionsViaRoles());
        }

        return $permissions->sort()->values();
    }
public function getAllPermissions(): Collection
    {
        $permissions = $this->permissions;

        if ($this->roles) {
            $permissions = $permissions->merge($this->getPermissionsViaRoles());
        }

        return $permissions->sort()->values();
    }
public function getAllPermissions ( ) : Collection { $ permissions = $ this -> permissions ; if ( $ this -> roles ) { $ permissions = $ permissions -> merge ( $ this -> getPermissionsViaRoles ( ) ) ; } return $ permissions -> sort ( ) -> values ( ) ; }
Return all the permissions the model has, both directly and via roles.

@throws \Exception
Return all the permissions the model has both directly and via roles .