I want to make a relationship queries on the three tables I have tblSchedule
tblUserHomeCourt
and tblHomeCourt
they have following structure
tblSchedules
->scheduleId
->userHomeCourtId
->timeFrom
->timeTo
->duration
tblUserHomeCourts
->userHomeCourtId
->userId
->homeCourtId
tblHomeCourts
->homeCourtId
->homeCourtName
->lat
->long and other details
Now, schedule will store the schedules of an user whereas userHomeCourts will store the current active homeCourt and homeCourt will provide the list of available homecourts.
how to fetch these details for a user?
in my schedule model I have tried hasManyThrough
but it's giving me empty array of schedule
public function schedule() {
return $this->hasManyThrough(HomeCourt::class,UserHomeCourt::class, 'homeCourtId', 'homeCourtId','scheduleId');
}
via Bhavik Bamania