title: Laravel Relationship where foreign key is two columns
body: <p>I have an application where I have some data in a table called "games" that looks something like this:</p>
  
  <pre><code># games
  +----+---------+--------+--------+
  | id | name    | dataId | parent |
  +----+---------+--------+--------+
  | 1  | Team1   | 444    | null   |
  +----+---------+--------+--------+
  | 2  | Team2   | 445    | null   |
  +----+---------+--------+--------+
  | 3  | Team1.1 | 445    | 1      |
  +----+---------+--------+--------+
  | 4  | Team2.1 | 445    | 2      |
  +----+---------+--------+--------+
  | 5  | Team2.2 | 445    | 2      |
  +----+---------+--------+--------+
  | 6  | Team3   | 446    | null   |
  +----+---------+--------+--------+
  | 7  | Team4   | 447    | null   |
  +----+---------+--------+--------+
  </code></pre>
  
  <p>As you can see a record can have a parent that points to the main record in the table.</p>
  
  <p>I also have another table called "fixtures", this table looks as follows:</p>
  
  <pre><code># fixtures
  +----+--------+--------+-------+
  | id | homeId | awayId | score |
  +----+--------+--------+-------+
  | 1  | 444    | 445    | 0     |
  +----+--------+--------+-------+
  | 2  | 445    | 446    | 0     |
  +----+--------+--------+-------+
  | 3  | 446    | 447    | 0     |
  +----+--------+--------+-------+
  </code></pre>
  
  <p>So what I would like to do is use Eloquent to join the two tables as follows:</p>
  
  <pre><code>// For Home:
  WHERE fixtures.homeId = games.dataId AND games.parent = null
  
  // And another for Away:
  WHERE fixtures.awayId = games.dataId AND games.parent = null
  </code></pre>
  
  <p>I was thinking I could use a OneToMany but I can only specify one foreign key.</p>
  
  <p>Is this possible in Laravel? If so how?</p>