public function currentTeam()
    {
        if (is_null($this->current_team_id) && $this->hasTeams()) {
            $this->switchToTeam($this->teams->first());

            return $this->currentTeam();
        } elseif (! is_null($this->current_team_id)) {
            $currentTeam =  $this->teams->find($this->current_team_id);

            return $currentTeam ?: $this->refreshCurrentTeam();
        }
    }
public function currentTeam()
    {
        if (is_null($this->current_team_id) && $this->hasTeams()) {
            $this->switchToTeam($this->teams->first());

            return $this->currentTeam();
        } elseif (! is_null($this->current_team_id)) {
            $currentTeam =  $this->teams->find($this->current_team_id);

            return $currentTeam ?: $this->refreshCurrentTeam();
        }
    }
public function currentTeam ( ) { if ( is_null ( $ this -> current_team_id ) && $ this -> hasTeams ( ) ) { $ this -> switchToTeam ( $ this -> teams -> first ( ) ) ; return $ this -> currentTeam ( ) ; } elseif ( ! is_null ( $ this -> current_team_id ) ) { $ currentTeam = $ this -> teams -> find ( $ this -> current_team_id ) ; return $ currentTeam ? : $ this -> refreshCurrentTeam ( ) ; } }
Get the team that user is currently viewing.

@return \Illuminate\Database\Eloquent\Model|null
Get the team that user is currently viewing .