title: How do I traverse through model relationships in laravel with dot syntax
body: <p>I'm trying to traverse through complex eloquent model relationships/attributes, and I'd like to use a simple dot structure to iterate through this, similar to how you can traverse arrays with <code>Arr::get()</code></p>
  
  <p>Example:</p>
  
  <pre><code>$data = [
    'foo' =&gt; [
      'bar' =&gt; [
        'key' =&gt; 'value'
      ]
    ]
  ];
  $value = Arr::get($data, 'foo.bar.key'); // returns 'value'
  </code></pre>
  
  <p>I've tried using </p>
  
  <pre><code>$value = Arr::get($model, 'relation.subrelation.attribute')
  </code></pre>
  
  <p>However this fails and aways returns null, even though eloquent models support ArrayAccess.</p>
  
  <p>Does laravel have a simple way to accomplish this?</p>