I have 2 model LeaveApplication and LeaveDetails model i would link to inner join leave with leaveDetails model
LeaveApplication Model
class LeaveApplication extends Model {
public $table = 'leave_application';
protected $fillable = ['user_id', 'start_date', 'end_date'];
public function leaveDetails() {
return $this->hasMany("App\LeaveDetails", 'application_id');
}
}
This is LeaveDetails Model
class LeaveDetails extends Model {
public $table = "leave_details";
public $fillable = ['application_id','leave_date','leave_type'];
}
I try to access this using LeaveApplication::with('leaveDetails')->where('leaveDetails.leave_date','2016-10-10')->get()
It give me Error , This is not create inner join in eloquent.
I am also use whereHas('leaveDetails') and this not use inner join