@php // Works for array OR Eloquent object $id = data_get($card, 'id'); $emoji = trim((string) data_get($card, 'icon_emoji', '')); $biClass = trim((string) data_get($card, 'icon', '')); // e.g. "bi bi-shield-lock" $title = data_get($card, 'title') ?? (data_get($card, 'name') ?? '未命名'); $routeName = data_get($card, 'route_name'); $show = (int) data_get($card, 'show_in_menu', 1) === 1; // Pastel background per-id $palette = [ '#E8F3FF', '#EAF9F0', '#FFF4E6', '#F9E8FF', '#EAF0FF', '#FFF0F3', '#EEFCE8', '#F0F4FF', '#FFEFE0', '#E9FFF9', ]; $chipBg = $palette[is_numeric($id) ? $id % count($palette) : 0]; $chipFg = '#334155'; // Optional per-card color override (#RRGGBB) $cardColor = data_get($card, 'color'); if ($cardColor && preg_match('/^#?[0-9A-Fa-f]{6}$/', $cardColor)) { $hex = ltrim($cardColor, '#'); $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); $chipBg = sprintf('rgba(%d,%d,%d,0.18)', $r, $g, $b); $chipFg = sprintf('#%02x%02x%02x', max(0, $r - 60), max(0, $g - 60), max(0, $b - 60)); } // Fallback icon if both empty if ($emoji === '' && $biClass === '') { $biClass = 'bi bi-grid'; } @endphp {{-- PARTIAL:_card LOADED --}}
@if ($emoji !== '') @else @endif

{{ $title }}

@if ($routeName)
{{ $routeName }}
@endif
@once @push('styles') @endpush @endonce