feat: tambah Filament 5 resources dengan schemas dan tables

This commit is contained in:
2026-04-03 04:22:34 +07:00
parent 401aa30ce8
commit aef6978b2a
48 changed files with 1211 additions and 0 deletions
@@ -0,0 +1,42 @@
<?php
namespace App\Filament\Resources\Users\Schemas;
use App\Models\Division;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
class UserForm
{
public static function configure(Schema $schema): Schema
{
return $schema->components([
TextInput::make('name')->required(),
TextInput::make('email')->email()->unique(ignoreRecord: true),
TextInput::make('password')->password()->revealable()
->required(fn ($operation) => $operation === 'create')
->dehydrateStateUsing(fn ($state) => filled($state) ? bcrypt($state) : null)
->dehydrated(fn ($state) => filled($state)),
TextInput::make('phone')->label('Telepon'),
Textarea::make('address')->label('Alamat')->rows(2)->columnSpanFull(),
Select::make('division_id')->label('Divisi')
->options(Division::pluck('name', 'id'))
->searchable(),
Select::make('status')
->options(['aktif' => 'Aktif', 'nonaktif' => 'Nonaktif'])
->default('aktif')
->required()
->live(),
Textarea::make('inactive_reason')->label('Alasan Nonaktif')
->visible(fn ($get) => $get('status') === 'nonaktif')
->required(fn ($get) => $get('status') === 'nonaktif')
->columnSpanFull(),
DatePicker::make('last_activity_date')->label('Terakhir Aktif'),
Select::make('roles')->relationship('roles', 'name')
->multiple()->preload()->label('Role'),
]);
}
}