public function getAllTeamsForUser($user)
    {
        $teams = $user->teams()->with('owner')->get();

        foreach ($teams as $team) {
            $team->owner->setVisible(['name']);
        }

        return $teams;
    }
public function getAllTeamsForUser($user)
    {
        $teams = $user->teams()->with('owner')->get();

        foreach ($teams as $team) {
            $team->owner->setVisible(['name']);
        }

        return $teams;
    }
public function getAllTeamsForUser ( $ user ) { $ teams = $ user -> teams ( ) -> with ( 'owner' ) -> get ( ) ; foreach ( $ teams as $ team ) { $ team -> owner -> setVisible ( [ 'name' ] ) ; } return $ teams ; }
Get all of the teams for the user.

@param  \Illuminate\Contracts\Auth\Authenticatable  $user
@return \Illuminate\Database\Eloquent\Collection
Get all of the teams for the user .