title: Laravel access relation
body: <p>I want to access a relation of the model when I get all the results but I keep getting the following error:</p>
  
  <pre><code>Undefined property: Illuminate\Database\Eloquent\Collection::$voornaam 
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>- Model : Selectie.php
  
  public function User()
  {
      return $this-&gt;hasMany('User', 'id', 'user_id');
  }
  
  - Controller 
  
  $selectie = Selectie::where('wedstrijd_id', '=', $id)-&gt;get();
  
  return View::make('base.match.show')-&gt;with('selectie', $selectie);
  
  - View
  
  @foreach($selectie as $sel)
      {{ $sel-&gt;user-&gt;voornaam }}
  @endforeach
  </code></pre>