From 4748c03025c7c537a698e7f8bdef2e04fc447368 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 15 Jul 2024 09:52:43 +0300 Subject: [PATCH] Fix staff view --- .../Organizations/Resources/UserResource/Pages/ViewUser.php | 2 +- database/factories/UserFactory.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php b/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php index 4a81bcb1..6146f472 100644 --- a/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php +++ b/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php @@ -23,7 +23,7 @@ public function infolist(Infolist $infolist): Infolist ->columns() ->schema([ TextEntry::make('status') - ->formatStateUsing(fn ($state) => $state->label()), + ->formatStateUsing(fn ($state) => $state === '-' ? $state : $state->label()), TextEntry::make('updated_at'), ]), Section::make() diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index e659559b..0f06c6f9 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -4,6 +4,7 @@ namespace Database\Factories; +use App\Enums\UserStatus; use App\Models\Organization; use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; @@ -28,6 +29,7 @@ public function definition(): array 'first_name' => fake()->firstName(), 'last_name' => fake()->lastName(), 'email' => fake()->unique()->safeEmail(), + 'status' => fake()->randomElement(UserStatus::values()), 'password' => static::$password ??= Hash::make('password'), 'remember_token' => Str::random(10), ];