Files
Kol-Manager/app/Providers/AppServiceProvider.php
2026-04-01 08:04:56 +07:00

28 lines
648 B
PHP

<?php
declare(strict_types=1);
namespace App\Providers;
use App\Models\Event;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register(): void {}
public function boot(): void
{
// Inject alert badge count into all views
View::composer('*', function (\Illuminate\View\View $view): void {
try {
$alertCount = Event::upcoming(24)->count();
} catch (\Throwable) {
$alertCount = 0;
}
$view->with('alertCount', $alertCount);
});
}
}