blaab2
4 months ago

belongsToThrough with eloquent and different relationsships

Posted 4 months ago by blaab2

user

id - integer
name - string

field

id - integer
user_id - integer
name - string

jobs

id - integer
field_id - integer
title - string
jobpackage_id - integer

jobpackages

id - integer
name - string

How can I use eloquent to query all jobs of a jobpackage and eager load the corresponding users? I dont know how to add a oneToOne Relationship to a job, so I can query the corresponding user.

I hope you can help me =)

Please sign in or create an account to participate in this conversation.