Files
ProjectKP/KP-ASOY FIX (2)/KP-ASOY/app/Providers/AppServiceProvider.php
T
2026-06-28 15:14:51 +07:00

36 lines
1022 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Auth;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
View::composer('layouts.navbar', function ($view) {
if (session()->has('api_token')) {
$notifications = [
['text' => 'Kegiatan sudah ditinjau super admin', 'is_read' => false],
['text' => 'Aktivitas berhasil disimpan', 'is_read' => true],
['text' => 'Perubahan data tersimpan', 'is_read' => true],
];
$unreadCount = collect($notifications)->where('is_read', false)->count();
$view->with(compact('notifications', 'unreadCount'));
}
});
}
}