title: Laravel relationship HasMany
body: <p>I keep multiple address records belonging to a user. but when i write with dd i can't access other table's data.</p>
  <p>Following my code:</p>
  <p><code>user</code> Table</p>
  <pre><code>id |    name       | country |
  --- --------------  ----------   
  
  7  | Mr. Lenny Bins| Belgium
  2  | Dalton Miller | Swaziland
  </code></pre>
  <p><code>address</code> Table</p>
  <pre><code>user_id | address         
  -------- ---------
  7       | 740 Brown Greens Suite  
  7       | 9906 Cleora Wall Apt.      
  2       | 53977 Kip Center Apt
  </code></pre>
  <p><code>UserModel</code></p>
  <pre><code> public function getAddress()
      {
          return $this-&gt;hasMany(Address::class);
      }
  </code></pre>
  <p><code>UserController</code></p>
  <pre><code>$users = User::where('id' ,7)-&gt;with('getAddress')-&gt;get();
  
  dd($users-&gt;toArray());
  // The output of this is below
  </code></pre>
  <p><a href="https://i.stack.imgur.com/xOrM1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xOrM1.png" alt="The output of this" /></a></p>
  <p><code>dd($users-&gt;getAddress-&gt;toArray());</code></p>
  <p>I get an error when I try like this.</p>
  <p>Property [getAddress] does not exist on this collection instance.</p>