title: Laravel: belongsTo() relation assume one-to-many relationship instead of one-to-one
body: <p>I'm having a tedious problem with Laravel's ORM.</p>
  
  <p>I have a model with multiple relationships, like this:</p>
  
  <pre><code>class Pages extends Eloquent {
  
      protected $guarded = array('id','config_id');
  
      public function template()
      {
          return $this-&gt;belongsTo('Templates', 'templates_id');
      }
  
      public function updateUser()
      {
          return $this-&gt;belongsTo('Users', 'updated_by');
      }
  </code></pre>
  
  <p>Now I can access the template related item in a simple way, like this:</p>
  
  <pre><code>$this-&gt;template-&gt;name;
  </code></pre>
  
  <p>And it works out of the bat, because Laravel's ORM assumes it is a one-to-one relationship and internally calls the first() method.</p>
  
  <p>But when I try the same with updateUser it fails, returning an error, saying that it can't call name on a non-object.</p>
  
  <p>But if I try this:</p>
  
  <pre><code>$this-&gt;updateUser()-&gt;first()-&gt;name;
  </code></pre>
  
  <p>it works, but it doesn't feel right to me.</p>
  
  <p>So my question is, how Laravel's ORM decide if a relationship defined with belongsTo() is one-to-one or one-to-many? Is there a way to force a needed behaviour?</p>
  
  <p>Thanks</p>