title: hasOneThrough with pivot table laravel eloquent
body: <p>I have the following tables</p>
  
  <pre><code>mysql&gt; describe records;
  +-----------------+---------------------+------+-----+---------+----------------+
  | Field           | Type                | Null | Key | Default | Extra          |
  +-----------------+---------------------+------+-----+---------+----------------+
  | id              | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
  | event_school_id | bigint(20) unsigned | NO   | MUL | NULL    |                |
  | athlete_id      | bigint(20) unsigned | NO   | MUL | NULL    |                |
  | year            | int(10) unsigned    | NO   |     | NULL    |                |
  | place           | int(10) unsigned    | NO   |     | NULL    |                |
  | created_at      | timestamp           | YES  |     | NULL    |                |
  | updated_at      | timestamp           | YES  |     | NULL    |                |
  | deleted_at      | timestamp           | YES  |     | NULL    |                |
  +-----------------+---------------------+------+-----+---------+----------------+
  8 rows in set (0.01 sec)
  
  mysql&gt; describe event_school;
  +------------+---------------------+------+-----+---------+----------------+
  | Field      | Type                | Null | Key | Default | Extra          |
  +------------+---------------------+------+-----+---------+----------------+
  | id         | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
  | event_id   | bigint(20) unsigned | NO   | MUL | NULL    |                |
  | school_id  | bigint(20) unsigned | NO   | MUL | NULL    |                |
  | notes      | text                | NO   |     | NULL    |                |
  | created_at | timestamp           | YES  |     | NULL    |                |
  | updated_at | timestamp           | YES  |     | NULL    |                |
  | deleted_at | timestamp           | YES  |     | NULL    |                |
  +------------+---------------------+------+-----+---------+----------------+
  7 rows in set (0.00 sec)
  
  mysql&gt; describe events;
  +-------------+---------------------+------+-----+---------+----------------+
  | Field       | Type                | Null | Key | Default | Extra          |
  +-------------+---------------------+------+-----+---------+----------------+
  | id          | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
  | name        | varchar(191)        | NO   |     | NULL    |                |
  | category_id | bigint(20) unsigned | NO   | MUL | NULL    |                |
  | created_at  | timestamp           | YES  |     | NULL    |                |
  | updated_at  | timestamp           | YES  |     | NULL    |                |
  | deleted_at  | timestamp           | YES  |     | NULL    |                |
  +-------------+---------------------+------+-----+---------+----------------+
  6 rows in set (0.00 sec)
  </code></pre>
  
  <p>From my Record Eloquent model, how can I get an <strong>event</strong> from a record. It needs to go though event_school pivot table; but I don't have a model for EventSchool. Do I need to make one? Is there a way to do that without EventSchool model?        </p>
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  class EventSchool extends Model
  {
      use SoftDeletes;
      protected $guarded = ['id'];
      protected $table = 'event_school';
  
      public function event()
      {
          return $this-&gt;belongsTo('App\Event');
      }
  
      public function school()
      {
          return $this-&gt;belongsTo('App\School');
      }
  
  }
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  class Record extends Model
  {
      use SoftDeletes;
      protected $guarded = ['id'];
  
      public function athlete()
      {
          return $this-&gt;belongsTo('App\Athlete');
      }
  
      function event_school()
      {
          return $this-&gt;belongsTo('App\EventSchool','event_school_id');
      }
  
      function event()
      {
          //What can I put here to complete method
  
          //right now have to do \App\Record::find(1)-&gt;event_school-&gt;event
  
          //Want to do \App\Record::find(1)-&gt;event
      }
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Here is output from one of the answers</p>
  
  <pre><code>&gt;&gt;&gt; \App\Record::find(3)-&gt;event_school-&gt;event
  =&gt; App\Event {#3035
       id: 1,
       name: "100 Meter",
       category_id: 1,
       created_at: null,
       updated_at: null,
       deleted_at: null,
     }
  &gt;&gt;&gt; \App\Record::find(3)-&gt;event
  =&gt; null
  </code></pre>