You can do it this way:
$result = Pool::join('Contribution', 'Pool.id', '=', 'Contribution.pool_id')
->join('Contributer', 'Contribution.contributer_id', '=', 'Contributer.id')->get();
Or, if you define the relationships in models, such as:
class Pool extends Eloquent {
...
public function contributers(){
return $this->belongsToMany('Contributer', 'contribution');
}
...
}
class Contributer extends Eloquent {
...
public function pools(){
return $this->belongsToMany('Pool', 'contribution');
}
...
}
you can access related models as:
$contributers = $pool->contributers()->get(); // Returns Illuminate/Database/Eloquent/Collection object containing contributers of the pool
or you can do eager loading such as:
$result = Pool::with('contributers')->get();
see http://laravel.com/docs/eloquent#relationships for more details.