Skip to content

Commit

Permalink
nofuzy
Browse files Browse the repository at this point in the history
  • Loading branch information
alihardan committed Jan 5, 2025
1 parent 6008ede commit f886682
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Http/Controllers/PublicApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f886682

Please sign in to comment.