@php use Carbon\Carbon; use App\Models\AdminMessage; $now = Carbon::now(); $currentDestination = null; if (request()->is('admin') || request()->is('admin/*')) { $currentDestination = null; } elseif (request()->is('provider') || request()->is('provider/*')) { $currentDestination = 'provider'; } else { $currentDestination = 'pharmacien'; } $adminMessages = collect(); if ($currentDestination) { $adminMessages = AdminMessage::query() ->where('status', 1) ->whereIn('destination', ['all', $currentDestination]) ->where(function ($query) use ($now) { $query->whereNull('valid_until') ->orWhereDate('valid_until', '>=', $now->toDateString()); }) ->orderByDesc('id') ->get(); } $totalChars = $adminMessages->sum(function($m) { return mb_strlen($m->message); }); $marqueeDuration = max(12, $totalChars * 0.12); @endphp @if($adminMessages->count() > 0)
@endif {{-- ── Main footer ── --}}