What do u want to get? its not clear yet for me.
Sep 26, 2017
5
Level 1
Need help with Eloquent data model/relationships or query statement
I'm trying to get all reservation times for all accounts belonging to the authenticated user. Here are the models:
users: id, name
account_user (pivot): account_id, user_id
accounts: id, accountname
account_schedule (pivot): account_id, schedule_id
schedules: id, accountname, reservationtime
Relationships:
- users has many accounts
- accounts has many schedules
I have tried both query builder and eloquent and can't figure it out. Do I need to fix the data model? If the data model is good, what would the eloquent statement be?
Any help would be greatly appreciated!!
Please or to participate in this conversation.