Level 50
that query only returns one number. but if you want to select all pages ordered by sum of their ratings and their ratings, you could do something like this:
DB::table('posts')
->selectRaw("website_id, SUM(stars) AS website_rating_sum")
->groupBy('website_id')
->orderByDesc('website_rating_sum')
->get();
you get this:
[
[
`website_id` => 5,
`website_rating_sum` => 10,
],
[
`website_id` => 1,
`website_rating_sum` => 3,
],
...