laravelrelation

laravel relation model -> belongsTo Model2 -> hasOne Model3


I am missing a laravel relation or I just don't get it... it is not hasOneThrough or belongsToThrough

The relation is as in the topic:

an Invoice (fkey customer_id) belongsTo Customer that Customer hasOne BankData (fkey customer_id)

Am I missing an "eloquent way" for that relation? I could not find any answer to this ... I'd like to query all Invoices with that customers bankdata with a relation

edit: actually I was thinking way to complex ... I was working with Invoices and needed the customers bankData, without loading the whole customer, which I did not need. since both models do have the customer_id, a simple join did the trick


Solution

  • actually I was thinking way to complex ... I was working with Invoices and needed the customers bankData, without loading the whole customer, which I did not need. since both models do have the customer_id, a simple join did the trick