title: laravel how to get image information from relationship and optimize it
body: <p><strong>Product model</strong><br />
  id  (column)<br />
  productname  (column)</p>
  <p><strong>ProductGallery model</strong><br />
  galleryid (column)<br />
  productid (column)</p>
  <p><strong>Galleries model</strong><br />
  id (column)<br />
  imagename (column)</p>
  <p>hello i want retrive data like this, my model is in the top</p>
  <pre><code>&quot;id&quot; =&gt; 1
  productname =&gt; &quot;product 1&quot;
  galleries =&gt; {
     0 =&gt; {
           id =&gt; 1,
           imagename =&gt; 'image 1'
          }
     1 =&gt; {
           id =&gt; 2,
           imagename =&gt; 'image 2'
          }
  }
  </code></pre>
  <p>how can i achive this using relationship and optimize?</p>