Skip to content
Advertisement

Join 2 tables in a Single Eloquent Laravel using multiple where clause

here I’d like to find the solution to simplify my query to get data using eloquent in Laravel.

JavaScript

So here I have 2 Eloquent operations to get Rooms which not included in the Booking Table with specified requirements. So far I have no problem with it, but can you guys give me best practice to simplify from what I do? Thank you.

Advertisement

Answer

Make sure that ‘bookings’ relation is written on your Room model.

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