title: Joining two tables on Eloquent
body: <p>I need to join two tables on my query.</p>
  
  <p>Database structure</p>
  
  <pre><code>Products
      .id
      .image
      .category_id (points to categories.id)
  
  Categories
      .id
      .category_name
      .category_directory_name
  </code></pre>
  
  <p>Images are under <code>category_directory_name</code> directory, so I need to set a relation between these two tables so I can get <code>category_directory_name</code> of each <code>product</code>.</p>
  
  <p>Something like;</p>
  
  <pre><code>&lt;img src="{{ URL::to('uploads/categories/' . $v-&gt;category_directory_name . '/' . $v-&gt;image') }}"&gt;
  </code></pre>
  
  <p>How can I do it?</p>
  
  <p>Ps. My table and column namings are local, so I'm not using builtin features of Laravel and Eloquent. I want to define table and column names myself.</p>