speedydan
7 months ago

Calculating review scores

Posted 7 months ago by speedydan

Hi there,

I have a 'Listing' eloquent model, which hasMany 'Reviews'. In the reviews table, I have an overall_rating column.

On the homepage, i'd like to show the top 10 highest overall rated listings. I'm wondering if someone could show me how I would approach this sort of query? For each listing, I'd need to calculate the overall_rating average for each attached review. I can't help but feel the way I'm doing it is a bit messy!

Please sign in or create an account to participate in this conversation.