From cbe2cf868d9476d56508d32725e12d8845778ef7 Mon Sep 17 00:00:00 2001 From: alihardan Date: Mon, 20 May 2024 04:39:20 +0330 Subject: [PATCH] feat: add nofuzy api --- app/Http/Controllers/PublicApiController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 362a4a0..84eefa5 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -92,4 +92,14 @@ public function lostGames() { return str_replace("lost-games/", "", Storage::disk('public')->files('lost-games')); } + + public function nofuzy1() + { + header("Content-type: text/csv"); + $games = Game::with(['producers:slug,title_fa,title_en', 'publishers:slug,title_fa,title_en'])->latest()->get(); + echo "id,tilte_en,title_fa,publisher\n"; + $games->each(function ($game) { + echo $game->id . "," . ($game->title_en ?? $game->games[0]['title_en'][0] ?? '') . "," . ($game->title_fa ?? $game->games[0]['title_fa'][0] ?? '') . "," . $game->publishers[0]->title_fa[0] ?? '' . "\n"; + }); + } }