Courses

Re-creating Booking.com API with Laravel and PHPUnit

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...

This lesson is only for Premium Members.
Want to access all lessons of this course?

You also get:

  • 68 courses (1183 lessons, 43 h 18 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord