Courses

Re-creating Booking.com API with Laravel and PHPUnit

Time for us to talk about rating of the apartments. After their stay, users are asked to rate the property.


Goals of This Lesson

  • Rating DB structure
  • Endpoint for saving the ratings and reviews
  • Show ratings in the search results
  • Order search results by ratings

By the end of this lesson, we will have this in Postman - see the last two fields returned:


Ratings DB Schema

While browsing Booking.com, I found out that only one main number of the user's ratings is actually calculated in the average of the property. Users are asked to rate separately many more features - cleanliness, friendly staff, etc - but we will not implement that. We will simplify it into this:

  • Every booking may have a rating (1-10) and a text-form review comment
  • This rating is attached to the booking for the apartment, but in the search result we need to calculate the average for all the apartments of the property

So, step by step...

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

You also get:

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