From badb4572b690f855637bcbc5c7e285cf4700f81f Mon Sep 17 00:00:00 2001 From: Fardan Nozami Ajitama Date: Thu, 1 May 2025 11:26:23 +0700 Subject: [PATCH] fix: adding condition at dashboard --- app/Filament/Pages/Dashboard.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index e5026021..b41e1495 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -2,7 +2,23 @@ namespace App\Filament\Pages; +use Filament\Facades\Filament; +use Illuminate\Support\Facades\Auth; + class Dashboard extends \Filament\Pages\Dashboard { protected static ?string $title = 'Beranda'; -} \ No newline at end of file + + public function getWidgets(): array + { + /** @var User $user */ + $user = Auth::user(); + if ($user->hasRole('Mahasiswa')) { { + return [ + \App\Filament\Widgets\CustomAccountWidget::class, + ]; + } + } + return Filament::getWidgets(); + } +}