title: Lavel 5.6.8 Eloquent: many to many + many to one pluck method
body: <p>Database structure</p>
  
  <p><strong>users</strong></p>
  
  <ul>
  <li>id</li>
  <li>username</li>
  <li>password</li>
  </ul>
  
  <p><strong>cityareas</strong></p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>area_id</li>
  </ul>
  
  <p><strong>cityarea_user</strong></p>
  
  <ul>
  <li>id</li>
  <li>cityarea_id</li>
  <li>user_id</li>
  </ul>
  
  <p><strong>areas</strong></p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  </ul>
  
  <p>I have also models where relationships are add.</p>
  
  <p><strong>User</strong></p>
  
  <pre><code>public function cityareas()
  {
      return $this-&gt;belongsToMany('App\Cityarea');
  }
  </code></pre>
  
  <p><strong>Cityarea</strong></p>
  
  <pre><code>public function area()
  
      {
          return $this-&gt;belongsTo('App\Area');
      }
  
  public function users()
  {
      return $this-&gt;belongsToMany('\App\User');
  }
  </code></pre>
  
  <p><strong>Area</strong></p>
  
  <pre><code>public function cityareas()
  {
      return $this-&gt;hasMany('App\Cityarea');
  }
  </code></pre>
  
  <p><strong>QUESTION:</strong>
  How I can get list (I try with pluck) on areas where user belongs?</p>
  
  <p>I try it make this:</p>
  
  <pre><code>$users = User::with('cityareas.area')-&gt;where('id', $id)-&gt;get();
  </code></pre>
  
  <p>Result is something like that</p>
  
  <p><a href="https://i.stack.imgur.com/hdZkM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hdZkM.png" alt="enter image description here"></a></p>
  
  <p>Then I try to pluck there only area.id or area.name or both but not working...
  What is best way to do this?</p>