title: Laravel 5 Eloquent relationship get the data
body: <p>I have two table.</p>
  
  <p>(Persons)</p>
  
  <pre><code>+------+------+ 
  | id   | name | 
  +------+------+ 
  |  1   | John | 
  +------+------+
  |  2   |Albert| 
  +------+------+
  </code></pre>
  
  <p>(Motors)</p>
  
  <pre><code>+------+------+------+ 
  | id   | name |  age | 
  +------+------+------+ 
  |   1  |   1  |  20  | 
  +------+------+------+ 
  |   2  |   2  |  21  | 
  +------+------+------+ 
  |   3  |   1  |  20  | 
  +------+------+------+
  </code></pre>
  
  <p>In "motors.name" i have the ids of people.</p>
  
  <p>I have two models.</p>
  
  <p>(Motors)</p>
  
  <pre><code>class Motors extends Eloquent
  {
      public function person(){
          return $this-&gt;hasMany('App\Persons', 'id');
      }    
  }
  </code></pre>
  
  <p>(Persons)</p>
  
  <pre><code>class Persons extends Eloquent
  {
      protected $table = 'persons';
      public function motors(){
          return $this-&gt;belongsTo('App\Motors', 'name', 'id');
      }    
  }
  </code></pre>
  
  <p>1 controller</p>
  
  <pre><code>class PrototypeController extends Controller
  {
      public function names(Request $request) {
          $res = Motors::get()-&gt;person-&gt;name;
          return view('pages.prototype', compact('res'));
      }
  }
  </code></pre>
  
  <p>1 view</p>
  
  <pre><code>&lt;ul class="list"&gt;
      @foreach ($res as $row)     
          @if (!empty($row-&gt;name))
              &lt;li class="list-group-item"&gt;
                  {!! $row-&gt;name !!}
              &lt;/li&gt;
          @endif
      @endforeach
  &lt;/ul&gt;
  </code></pre>
  
  <p>I'd like tosee the rerelational dara in view, not the ids. How can it be solved?</p>
  
  <p>This code isn't good: </p>
  
  <pre><code>$res = Motors::get()-&gt;person-&gt;name;
  </code></pre>
  
  <p>Thanks in advance for your help.</p>