title: Laravel 5 hasMany relationship on two columns
body: <p>Is it possible to have a hasMany relationship on two columns?</p>
  
  <p>My table has two columns, <code>user_id</code> and <code>related_user_id</code>.</p>
  
  <p>I want my relation to match either of the columns.</p>
  
  <p>In my model I have </p>
  
  <pre><code>public function userRelations()
  {
      return $this-&gt;hasMany('App\UserRelation');
  }
  </code></pre>
  
  <p>Which runs the query: <code>select * from user_relations where user_relations.user_id in ('17', '18')</code>.</p>
  
  <p>The query I need to run is: </p>
  
  <pre><code>select * from user_relations where user_relations.user_id = 17 OR user_relations.related_user_id = 17 
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I'm using eager loading and I think this will affect how it will have to work.</p>
  
  <pre><code>$cause = Cause::with('donations.user.userRelations')-&gt;where('active', '=', 1)-&gt;first();
  </code></pre>