title: Laravel One-to-Many and One-To-One relationship between the same tables
body: <p>I have 2 tables:
  Tourists,
  Tours. (and corresponding models Tourist, Tour).</p>
  
  <p>I have successfully set up many-to-many relationship between them. When I </p>
  
  <pre><code>$tour-&gt;tourists()-&gt;attach($tourist);
  </code></pre>
  
  <p>It creates a new record in a table Tour_Tourists. (tour_id, tourist_id, created_at, updated_at). It shows which tourists go with the particular tour.</p>
  
  <p>Now I need to create another entity: Buyer. The buyer is one of the Tourists who pays for the Tour. Only one of the tourists belonging to the tour can be a Buyer.</p>
  
  <p>I have set up one-to-one relations in both models:</p>
  
  <pre><code>&lt;?php
  </code></pre>
  
  <p>namespace App;</p>
  
  <p>class Tour extends Model
  {
      public function tourists() {</p>
  
  <pre><code>    return $this-&gt;belongsToMany('App\Tourist')
      -&gt;withTimestamps();
  
  }
  
  public function buyer() {
  
      return $this-&gt;hasOne('App\Tourist')
      -&gt;withTimestamps();
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>(and the same in Tourist model, except i changed 'App\Tourist' to 'App\Tour':</p>
  
  <pre><code>public function buyer() {
  
  return $this-&gt;hasOne('App\Tour')
  -&gt;withTimestamps();
  </code></pre>
  
  <p>)</p>
  
  <p>but when I do: </p>
  
  <pre><code>$tour-&gt;buyer()-&gt;($tourist) 
  </code></pre>
  
  <p>(where $tour and $tourist contain respective records from database), i get: </p>
  
  <pre><code>BadMethodCallException with message 'Call to undefined method Illuminate\Database\Query\Builder::withTimestamps()'
  </code></pre>
  
  <p>I have a feeling that I am doing it totally wrong. Can anyone just point out the direction I should move on to?</p>
  
  <p>thank you.</p>