Initial commit
This commit is contained in:
44
app/Filament/Resources/Users/Schemas/UserForm.php
Normal file
44
app/Filament/Resources/Users/Schemas/UserForm.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\MultiSelect;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class UserForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Imię i nazwisko')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('email')
|
||||
->label('Email')
|
||||
->email()
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('password')
|
||||
->label('Hasło')
|
||||
->password()
|
||||
->dehydrateStateUsing(fn (?string $state): ?string =>
|
||||
$state ? Hash::make($state) : null
|
||||
)
|
||||
->required(fn (string $operation): bool => $operation === 'create')
|
||||
->maxLength(255)
|
||||
->dehydrated(fn (?string $state): bool =>
|
||||
filled($state)
|
||||
),
|
||||
MultiSelect::make('roles')
|
||||
->label('Role')
|
||||
->relationship('roles', 'name')
|
||||
->preload()
|
||||
->searchable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user