Skip to main content

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

Read more here

Show Apartment Size, Type and Beds

Premium
9 min read

Now, let's try to show the property and apartment information in the search results, similarly to how it's done on the Booking.com website:

Booking search results apartments

As you can see, every apartment may have its type, size in square meters, number of small/large/sofa beds, and number of bedrooms, living rooms, and bathrooms. So let's return all of that.


Goals of This Lesson

  • Create DB structure for Apartment Type and size
  • Create DB structure for Rooms and Beds with Bed Types
  • Showing Rooms and Beds in Search Results
  • Look at a different project scenario: doctors/patients

By the end of this lesson, we will have this DB structure:

DB Structure with Beds


DB Structure: Apartment Type and Size

Let's add two fields to the apartments: their type and size (in square meters).

Types should have a separate DB table, with a relationship, so we do exactly that...

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 👍🌹

T
Timo ✓ Link copied!

Thanks, I really like the tutorials so far. But I have one question. What is the benefit of creating tables like bed_types instead of creating a simple enum BedType and defining a cast for it?

PK
Povilas Korop ✓ Link copied!

Good question, enum is also possible. But saving data in the DB makes it more flexible for future users to add more bed types (via adminpanel, for example), without asking developers to change it in the code.

T
Timo ✓ Link copied!

Thanks!

RL
Robert Li ✓ Link copied!

I think it is nice to add seeder so that we can also see the same results when calling postman