I have the following mysql query
select * from operatories o
left join apts ap on o.location = ap.Location and o.operatory = ap.Operatory;
I also have two models
class Operatories extends Model
{
public function operatories()
{
return $this->hasMany('App\Models\Appointment', 'Location', 'location');
}
}
Appointments:
class Appointment extends Model
{
public function operatories()
{
return $this->belongsTo('App\Models\Operatories', 'operatory', 'Operatory');
}
}
In my controller I am trying to write the mysql query,
this is what I have so far
$arrOperators = Operatories::leftJoin('appointment', function ($join) {
$join->on('appointments.location','=','operatories.location');
})
does anyone know how to write multiple on clause?