public function primaryGroup() : ?Model
    {
        if ($this->userPrimaryGroup !== null) {
            return $this->userPrimaryGroup;
        }

        $usergroups = $this->usergroups;

        foreach ($usergroups as $id => $usergroup) {
            if ($usergroup->primary) {
                return $this->userPrimaryGroup = $usergroup->group;
            }
        }

        return $this->userPrimaryGroup = $usergroups[0]->group;
    }
public function primaryGroup() : ?Model
    {
        if ($this->userPrimaryGroup !== null) {
            return $this->userPrimaryGroup;
        }

        $usergroups = $this->usergroups;

        foreach ($usergroups as $id => $usergroup) {
            if ($usergroup->primary) {
                return $this->userPrimaryGroup = $usergroup->group;
            }
        }

        return $this->userPrimaryGroup = $usergroups[0]->group;
    }
public function primaryGroup ( ) : ? Model { if ( $ this -> userPrimaryGroup !== null ) { return $ this -> userPrimaryGroup ; } $ usergroups = $ this -> usergroups ; foreach ( $ usergroups as $ id => $ usergroup ) { if ( $ usergroup -> primary ) { return $ this -> userPrimaryGroup = $ usergroup -> group ; } } return $ this -> userPrimaryGroup = $ usergroups [ 0 ] -> group ; }
Get users primary group

@return \Laranix\Auth\Group\Group|\Laranix\Support\Database\Model|null
Get users primary group