how can I choose which fields I want to get from the with
ORM eloquent. For example
$tourTeams = Tournament::with('teams')->where('id', $tourId)->first();
From the teams relation I want only to get the name (without the id and timestamps).
I didn't it in the documentation. For the Tournament
eloquent I can do it via the get
function while passing it an array of fields names, like this: get(array('name', 'id'))
. But how do I do this on the Team
eloquent?
Note: here is how Team related to Tournament, this code taken from the Tournament eloquent file:
public function teams() { return $this->belongsToMany('Team', 'Tournament_Team'); }