diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php index bb62d11..504c590 100644 --- a/app/Filament/Resources/UserResource.php +++ b/app/Filament/Resources/UserResource.php @@ -19,11 +19,12 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Support\Facades\Hash; + class UserResource extends Resource { protected static ?string $model = User::class; - protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; + protected static ?string $navigationIcon = 'heroicon-c-user-group'; protected static ?string $navigationGroup = 'User Management'; @@ -31,6 +32,13 @@ class UserResource extends Resource { return $form ->schema([ + Forms\Components\Select::make('plant_id') + ->relationship('plant', 'name') + ->nullable() + ->reactive() + ->default(function () { + return optional(User::latest()->first())->plant_id; + }), Forms\Components\TextInput::make('name') ->required() ->autofocus() @@ -94,6 +102,11 @@ class UserResource extends Resource $currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1; return ($currentPage - 1) * $perPage + $rowLoop->iteration; }), + Tables\Columns\TextColumn::make('plant.name') + ->label('Plant') + ->alignCenter() + ->sortable() + ->searchable(), Tables\Columns\TextColumn::make('name') ->label('User Name') ->alignCenter()