@php $toRows = static function ($value): array { if ($value instanceof \Illuminate\Support\Collection) { return $value->map(static fn ($row) => (array) $row)->all(); } if (is_array($value)) { return array_map(static fn ($row) => is_array($row) ? $row : (array) $row, $value); } if ($value instanceof \Traversable) { $rows = []; foreach ($value as $row) { $rows[] = is_array($row) ? $row : (array) $row; } return $rows; } return []; }; $stores = $toRows($stores ?? []); $managers = $toRows($managers ?? []); $questionSets = $toRows($questionSets ?? []); $questionRows = $toRows($questionRows ?? []); $visits = $toRows($visits ?? []); $answerDetails = $toRows($answerDetails ?? []); if (!is_array($currentUser ?? null)) { $currentUser = [ 'username' => (string)($currentUser->username ?? ''), 'role' => (string)($currentUser->role ?? 'user'), ]; } $role = (string)($role ?? ($currentUser['role'] ?? 'user')); $flash = (string) session('success', ''); $error = $errors->any() ? (string) $errors->first() : ''; if (!function_exists('h')) { function h($value): string { return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); } } if (!function_exists('status_meta')) { function status_meta(string $status): array { if ($status === 'active') return ['class' => 'badge bg-success-subtle text-success-emphasis', 'label' => 'Aktif']; if ($status === 'auto_logout') return ['class' => 'badge bg-danger-subtle text-danger-emphasis', 'label' => 'Otomatik Çıkış']; return ['class' => 'badge bg-primary-subtle text-primary-emphasis', 'label' => 'Tamamlandı']; } } @endphp YöreTech SKT Kontrol - Mağaza Ziyaret