@php
$faviconPath = (isset($systemSetting) && $systemSetting && $systemSetting->favicon)
? 'storage/' . $systemSetting->favicon
: 'assets/images/favicon.ico';
$faviconUrl = asset($faviconPath);
$faviconVersion = null;
if (isset($systemSetting) && $systemSetting && $systemSetting->favicon) {
$fullFaviconPath = public_path($faviconPath);
if (file_exists($fullFaviconPath)) {
$faviconVersion = filemtime($fullFaviconPath);
}
}
@endphp
@php
$isValidHex = static fn($color) => is_string($color) && preg_match('/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/', $color);
$hexToRgb = static function ($hex) {
$hex = ltrim($hex, '#');
if (strlen($hex) === 3) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
return [hexdec(substr($hex, 0, 2)), hexdec(substr($hex, 2, 2)), hexdec(substr($hex, 4, 2))];
};
$primaryColor = (isset($systemSetting) && $isValidHex($systemSetting->primary_color ?? null))
? $systemSetting->primary_color
: '#14796e';
$secondaryColor = (isset($systemSetting) && $isValidHex($systemSetting->secondary_color ?? null))
? $systemSetting->secondary_color
: '#6cbdb3';
$primaryRgb = implode(', ', $hexToRgb($primaryColor));
@endphp