From f88668259616026b6df22f5e32fd15227b0062be Mon Sep 17 00:00:00 2001 From: alihardan Date: Sun, 5 Jan 2025 18:51:09 +0330 Subject: [PATCH] nofuzy --- app/Http/Controllers/PublicApiController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 0641cd7..38f66ef 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -88,13 +88,16 @@ public function nofuzy1() public function nofuzy2() { $games = Game::with(['producers:title_fa', 'publishers:title_fa'])->latest()->get()->map(function ($game) { + + $tgfiles = TGFile::whereIn('file_unique_id', $game->tgfiles)->orderByRaw("FIELD(file_unique_id, '" . implode("','", $game->tgfiles) . "')")->get(['file_id', 'file_name', 'file_size', 'date']); + return [ 'slug' => $game->slug, 'title_en' => $game->title_en ?? $game->games[0]['title_en'][0] ?? '', 'title_fa' => $game->title_fa ?? $game->games[0]['title_fa'][0] ?? '', 'producers' => $game->publishers, 'publisher' => $game->publishers, - 'size' => $game->tgfiles ? collect($game->tgfiles)->sum('file_size') : 0, + 'size' => $tgfiles->sum('file_size'), ]; }); return $games;