36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Users\Schemas;
|
|
|
|
use Filament\Forms\Components\Checkbox;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class UserForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
TextInput::make('name')
|
|
->label('Name')
|
|
->required(),
|
|
TextInput::make('email')
|
|
->label('E-Mail')
|
|
->email()
|
|
->required()
|
|
->unique(ignoreRecord: true),
|
|
TextInput::make('password')
|
|
->label('Passwort')
|
|
->password()
|
|
->revealable()
|
|
->required(fn (string $operation) => $operation === 'create')
|
|
->dehydrateStateUsing(fn ($state) => filled($state) ? bcrypt($state) : null)
|
|
->dehydrated(fn ($state) => filled($state))
|
|
->minLength(8),
|
|
Checkbox::make('is_admin')
|
|
->label('Administrator'),
|
|
]);
|
|
}
|
|
}
|