Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Apartment Search by Number of Guests

Premium
5 min read

Now we're moving to the next filter in the search: people are looking for properties fit for their needs of space, by specifying the number of adults and children arriving.

booking.com search by capacity

Here's where we get to the next concept: apartments. Each property may have multiple apartments, not only for hotels but also for bigger houses are often divided into separate apartments for booking.


Goals of This Lesson

  • Create DB structure and Model for Apartment
  • Add property search condition to look for apartments within properties, suitable for the number of people
  • Extend PHPUnit tests for new search condition

By the end of this lesson, we will have this test passing:

Apartment search by capacity


Apartment DB Structure

So, our search needs to accept the number of adults and children and filter the properties by apartments that are fit for that number of people.

First, we create the Apartment model/migration, also adding a Factory for testing...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

AA
Ali Al Qahtani ✓ Link copied!

Great 👍