Only until March 18th: coupon LARAVEL12 for 40% off Yearly/Lifetime membership!

Read more here
Courses

Re-creating Booking.com API with Laravel and PHPUnit

Ratings: Order/Show in Search Results

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

The full lesson is only for Premium Members.
Want to access all 23 lessons of this course? (224 min read)

You also get:

  • 71 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord