回答編集履歴
1
誤字の修正
answer
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
```Controller
|
4
4
|
$devices = Device::query()
|
5
|
-
->selectRaw('devices.*, (select count(*) from users inner join device_follow on users.id = device_follow.user_id inner join game_follow on users.id = game_follow.user_id where devices.id = device_follow.device_id and game_follow.game_id =
|
6
|
-
->orderBy('
|
5
|
+
->selectRaw('devices.*, (select count(*) from users inner join device_follow on users.id = device_follow.user_id inner join game_follow on users.id = game_follow.user_id where devices.id = device_follow.device_id and game_follow.game_id = '.$game->id.') as followers_count')
|
6
|
+
->orderBy('followers_count', 'desc')
|
7
7
|
->get();
|
8
8
|
```
|