I have three tables
institutes
id,name,email,etc...
reviews
id,institute_id,rating,description,etc...
courses
id,institute_id,name,etc...
coupons
id,course_id,code,discount,etc...
Institute extends Model{
public function reviews(){
return $this->hasMany(Review:class);
}
}
I do have all the necessary relations setup.
Sort institutes by popularity, popularity here means just the number of reviews, I have done the rest calculations.
Sort by discount, ascending or descending.
What approaches should I use? I would prefer eloquent way. Any help would be of great help.