O'Reilly logo
  • GIL EG thinks this is interesting:

// file: app/User.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class User extends Model { public function researches() { return $this->hasMany('App\Research'); } public function sections() { return $this->hasManyThrough('App\Section', 'App\Research'); } }

From

Cover of Learning Laravel's Eloquent

Note

hasManyThrough() to access related models of related models