title: Laravel belongsToMany relationship with only one result
body: <p>I have a relationship between two tables with a join table that only has one result. </p>
  
  <p>When I define a Laravel belongsToMany relationship, instead of returning a collection with only one element I would like to have it return that item alone.</p>
  
  <p>Is there a way to model this in Laravel?</p>
  
  <p>Thanks in advance. </p>
  
  <p>[<strong>EDIT</strong>]</p>
  
  <p>I'll try to explain what I want using the classic Users/Roles example. Besides de <code>users</code> and <code>roles</code> tables, we'll have a <code>users_roles</code> pivot table which will store all the roles the user has had. A user can, at any given time, have only one active role (identified by the <code>active</code> attribute being <code>true</code>). </p>
  
  <pre class="lang-php prettyprint-override"><code>class User {
      function role() {
          return $this-&gt;belongsToMany('App\Role')-&gt;wherePivot('active', 'true');
      }
  }
  </code></pre>
  
  <p>With this relationship definition, when I access <code>$user-&gt;role</code> I get a collection (with only one element) of Roles. What I would like is to have that Role instance directly.</p>