@php if (!isset($groups)) { $items = []; // ================= FROM DB ================= foreach ($providersNav as $p) { $slug = strtolower(preg_replace('/[^a-z0-9]/', '-', $p->provider_slug)); $class = !empty($p->provider_flag) ? str_replace('provider--', 'item--', $p->provider_flag) : 'item--provider'; $items[] = [ 'url' => '/arcade/' . $slug, 'img' => $p->provider_image, 'name' => ucwords(strtolower($p->provider_name)), 'class' => $class, 'id' => null ]; } // ================= FALLBACK PR ================= if (!collect($providersNav)->contains('provider_code', 'PR')) { $items[] = [ 'url' => '/arcade/pragmaticplay', 'img' => 'https://cdn-proxy.globalcontentcloud.com/common/dark/arcade/pragmaticplay_arcade.svg', 'name' => 'Pragmatic Play', 'class' => 'item--provider', 'id' => null ]; } // ================= FALLBACK MP ================= if (!collect($providersNav)->contains('provider_code', 'MP')) { $items[] = [ 'url' => '/arcade/microgaming', 'img' => 'https://cdn-proxy.globalcontentcloud.com/common/dark/arcade/microgaming_arcade.svg', 'name' => 'Microgaming', 'class' => 'item--provider', 'id' => null ]; } // ================= FALLBACK MP ================= if (!collect($providersNav)->contains('provider_code', 'SG')) { $items[] = [ 'url' => '/arcade/spadegaming', 'img' => 'https://cdn-proxy.globalcontentcloud.com/common/dark/arcade/spadegaming_arcade.svg', 'name' => 'Spadegaming', 'class' => 'item--provider', 'id' => null ]; } // ================= SORT (OPTIONAL - BIAR RAPI) ================= $items = collect($items) ->unique('url') ->values() ->toArray(); // ================= GROUPING ================= $groups = array_chunk($items, 15); } @endphp