From c6ac15ef438a827b616ffd713a3647be600caf91 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 30 May 2023 23:57:00 +0200 Subject: [PATCH] Add Tool funcs for Data Prep & Age Rating Icons --- app/Models/Game.php | 100 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/app/Models/Game.php b/app/Models/Game.php index de53e1b..35654e5 100644 --- a/app/Models/Game.php +++ b/app/Models/Game.php @@ -4,9 +4,109 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use App\Http\Controllers\IGDBController; class Game extends Model { use HasFactory; + public function fillGameDetails ($slug){ + + #$game_data = IGDBController::getGameDetails($slug); + $game_data = IGDBController::getPreparedGameDetails($slug); + + foreach ($game_data as $key => $value) { + $this->$key = $value; + } + + } + + public function getAgeRatingIcon ($rating_id){ + $icon_url = ""; + + switch ($rating_id) { + case "1": # PEGI 3 + $icon_url = "https://www.igdb.com/assets/pegi/PEGI_3-477c57b0d607627660e0ee86f4e39bad95233170528b028b21688faaba6a455b.png"; + case "2": # PEGI 7 + $icon_url = "https://www.igdb.com/assets/pegi/PEGI_7-fc2907b8d2f83bccc55070468cb0d4e90f1dd98a6a987cb53ed908e6eda31451.png"; + case "3": # PEGI 12 + $icon_url = "https://www.igdb.com/assets/pegi/PEGI_12-5c83ad44ed32a4c9bd40019d9817ba2ef69d2081db831285c64bfe08002a79ae.png"; + case "4": # PEGI 16 + $icon_url = "https://www.igdb.com/assets/pegi/PEGI_16-177256b4d01a59019d708199d71ccdc9721680ca8165c452b3eecff8bf47b61c.png"; + case "5": # PEGI 18 + $icon_url = "https://www.igdb.com/assets/pegi/PEGI_18-1efef95fe494465b999ef3d607f28e684a30341a0a9270a071fc559ee09577fc.png"; + case "6": # RP + $icon_url = "https://www.igdb.com/assets/esrb/esrb_rp-2b9f914da8685eb905a3cb874e497ce9848db879a65e43444c6998fc28852c9b.png"; + case "7": # Early Child (EC) + $icon_url = "https://www.igdb.com/assets/esrb/esrb_ec-c2202019bef0475ea95d5ffdbfd882f595912e4a6cbea9204132fa73a0804076.png"; + case "8": # Everyone (E) + $icon_url = "https://www.igdb.com/assets/esrb/esrb_e-3ff51fae393dfcf5decdd4daa462372f28e3d78b417906e64d3d65ff08179838.png"; + case "9": # Everyone (E10) + $icon_url = "https://www.igdb.com/assets/esrb/esrb_e10-2b4600f85680e68b6e65b050e150754607669cd2602a224c5d9198ecbf0a860f.png"; + case "10": # Teen (T) + $icon_url = "https://www.igdb.com/assets/esrb/esrb_t-addf8c69e4e93438b2a4cf046972279b7f9a6448929fbb0b0b7b7c28a0e60a24.png"; + case "11": # Mature (M) + $icon_url = "https://www.igdb.com/assets/esrb/esrb_m-5472ffae8a4488c825e55818f41312dcc04401e45302246d3d19b0a08014de96.png"; + case "12": # Adults Only (AO) + $icon_url = "https://www.igdb.com/assets/esrb/esrb_ao-53b8347d8123bf6cab401d0aa7e4f22aa88e25cb6b032be1813f967313bab2c5.png"; + case "13": # CERO_A + $icon_url = "https://www.igdb.com/assets/cero/CERO-A-7b18f77081ddbbf98d1695f72730d009da4fca31e35f340359b64764b297c41e.png"; + case "14": # CERO_B + $icon_url = "https://www.igdb.com/assets/cero/CERO-B-55bcb867080e544aa4472bcb21eecce372f092fd0fe907b8ea73288361e94a10.png"; + case "15": # CERO_C + $icon_url = "https://www.igdb.com/assets/cero/CERO-C-b62841527ba6465a361601c16b4572676bdccfeb5f50caf1dc852ac8adcadcd2.png"; + case "16": # CERO_D + $icon_url = "https://www.igdb.com/assets/cero/CERO-D-9d528564f72e69ca9d78219370542cc1884a85b094091357183c0a8b2c00f051.png"; + case "17": # CERO_Z + $icon_url = "https://www.igdb.com/assets/cero/CERO-Z-9c14d02eb02f2ae8aba21882d95d1ee7591ab972efeb1083e326bbbb2eb04177.png"; + case "18": # USK_0 + $icon_url = "https://www.igdb.com/assets/usk/USK-0-4f098f12737c231fbd56afca87c028d8c3c9581bc15a7865b9677d606bd69103.png"; + case "19": # USK_6 + $icon_url = "https://www.igdb.com/assets/usk/USK-6-d0af52754e00b7161d4592b17ab94003ae26f4160e58c365a6d9c0cdee9e3dc9.png"; + case "20": # USK_12 + $icon_url = "https://www.igdb.com/assets/usk/USK-12-b06a58c13f5f5bb93f938013ab77cdb3163f62eb91b8ad4cb116c7a7733dc94f.png"; + case "21": # USK_16 + $icon_url = "https://www.igdb.com/assets/usk/USK-16-3e1175aef83f8c046901f355cfac04d7cb775f00347c428786ece66b2100c78c.png"; + case "22": # USK_18 + $icon_url = "https://www.igdb.com/assets/usk/USK-18-c75d4bb544f4a98e7f903683e0ab28b8b0e02146fa3c478ab5bbde4e7ee71ef5.png"; + case "23": # GRAC_ALL + $icon_url = "https://www.igdb.com/assets/grac/GRAC-all-ea3b2809bf3dc6d6bf65af25c6c7a2736a644c2feb896afaec2ba5d60aad7ad8.png"; + case "24": # GRAC_Twelve + $icon_url = "https://www.igdb.com/assets/grac/GRAC-12-8739f938b93dabc915737e4302a6a530b001d56e0da105aa677d3f266997a91c.png"; + case "25": # GRAC_Fifteen + $icon_url = "https://www.igdb.com/assets/grac/GRAC-15-0f69666a48c254a680f2c51808b9831d311a3cbf14727c1fdb8332a9ce01b15a.png"; + case "26": # GRAC_Eighteen + $icon_url = "https://www.igdb.com/assets/grac/GRAC-18-17047dba082572bfefdb159b14bd2a65c3323473938cade2746e65ad01a091fa.png"; + case "27": # GRAC_TESTING + $icon_url = "https://www.igdb.com/assets/grac/GRAC-testing-fdb410e25ef5237353a2f8d98127ff3ef5aec2e4317da7c844fc426ba47462b9.png"; + case "28": # CLASS_IND_L + $icon_url = "https://www.igdb.com/assets/class_ind/ClassInd-L-0574985f80873413e495027fd5e71a30b589ef6801a3cf05d898c593ad694459.png"; + case "29": # CLASS_IND_Ten + $icon_url = "https://www.igdb.com/assets/class_ind/ClassInd-10-b2c0a0ce9872f295080bc85bfb96dee3643237b557f62b5051646ccbc9292e4f.png"; + case "30": # CLASS_IND_Twelve + $icon_url = "https://www.igdb.com/assets/class_ind/ClassInd-12-ae5d972b5ca5159c9dd5b4295d96f9dc8991a6cc863e5d1572900076420d211a.png"; + case "31": # CLASS_IND_Fourteen + $icon_url = "https://www.igdb.com/assets/class_ind/ClassInd-14-2f728c71718d4f6e2b03523e172dbc6fec3adf24a9c517fb607832262b090a62.png"; + case "32": # CLASS_IND_Sixteen + $icon_url = "https://www.igdb.com/assets/class_ind/ClassInd-16-72b2d94aee82d6552c2cda8e7e7f742f16621e832ef21b30eb8da2e99683abf7.png"; + case "33": # CLASS_IND_Eighteen + $icon_url = "https://www.igdb.com/assets/class_ind/ClassInd-18-8cfef0946bb2ec76b7462a8626d3ac57212f48bd4f9d65b6845f0aedeb055de3.png"; + case "34": # ACB_G + $icon_url = "https://www.igdb.com/assets/acb/ACB-G-1e1a8ffce64eb9f1103803e82ba597f2dfba9071a15645ac0055f0ecf4b1d3a3.png"; + case "35": # ACB_PG + $icon_url = "https://www.igdb.com/assets/acb/ACB-PG-e3994b0735b7dc5796d232fa422b50e069aed98a63a5694bac301c11d16ea56f.png"; + case "36": # ACB_M + $icon_url = "https://www.igdb.com/assets/acb/ACB-M-051441e5b1ccde43b84a2124fbbcbeb4d23624389d265914fd9bef4079a3fd63.png"; + case "37": # ACB_MA15 + $icon_url = "https://www.igdb.com/assets/acb/ACB-MA15-60f3d60093cb113bedb1224b2469a5a1cf23651bf53fb46dae4319091c0cd192.png"; + case "38": # ACB_R18 + $icon_url = "https://www.igdb.com/assets/acb/ACB-R18-08f8e4b9f19e35932a9d2bc1ecd9d3cdca50de35e11380308e1982caa16c5934.png"; + case "39": # ACB_RC + $icon_url = "https://www.igdb.com/assets/acb/ACB-RC-430420e914f169913dc375ed88c8d67dfab2d2786841241c9ea253e180c643b9.png"; + } + return $icon_url; + } + + + }