title: Eloquent relationships naming conventions
body: <p>I have articles with categories</p>
  
  <p>many articles each article belong to one category.</p>
  
  <p>each category has many articles</p>
  
  <p>article db name is "articles"</p>
  
  <p>categoery db name is "article_categories"</p>
  
  <pre><code>class Article extends Model
  {
      public function category()
      {
          return $this-&gt;belongsTo('App\ArticleCategory');
      }
  }
  class ArticleCategory extends Model
  {
      public function articles()
      {
          return $this-&gt;hasMany('App\Article');
      }
  }
  </code></pre>
  
  <p>now my question is: how should I name the column in articles which will store the category id?</p>
  
  <p>I tried naming it:</p>
  
  <pre><code>article_category_id
  articleCategory_id
  article_categories_id
  articleCategories_id
  </code></pre>
  
  <p>all of them not working as if I do</p>
  
  <pre><code>$article-&gt;category 
  </code></pre>
  
  <p>eloquent running this query:</p>
  
  <pre><code>select * from `article_categories` where `article_categories`.`id` is null limit 1
  </code></pre>
  
  <p>thanks</p>