Skip to content
Advertisement

how to compare two separate relations fields with each other in whereHas laravel?

I use laravel 9 and I have 3 model here :

order

JavaScript

shop

JavaScript

accepted_order

JavaScript

notice : accepted_order is not pivot table

JavaScript

Now I want to get accepted_orders where :

JavaScript

or

JavaScript

and both query orderBy created_at desc.

how can I use whereHas query that compare two separate relations field with each other?

thanks

Advertisement

Answer

I found it

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement