- Rollenbasierte Policies, Navigationsgruppen - Media Library (Spatie) für die kommende Bildverwaltung installiert Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.4 KiB
PHP
42 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Users\Schemas;
|
|
|
|
use App\Enums\UserRole;
|
|
use Filament\Forms\Components\Radio;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class UserForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->columns(2)
|
|
->components([
|
|
TextInput::make('name')
|
|
->label('Name')
|
|
->required()
|
|
->maxLength(255),
|
|
TextInput::make('email')
|
|
->label('E-Mail (Anmeldename)')
|
|
->email()
|
|
->required()
|
|
->unique(ignoreRecord: true)
|
|
->maxLength(255),
|
|
Radio::make('role')
|
|
->label('Rolle')
|
|
->options(UserRole::class)
|
|
->required()
|
|
->columnSpanFull(),
|
|
TextInput::make('password')
|
|
->label(fn (string $operation): string => $operation === 'create' ? 'Passwort' : 'Neues Passwort (leer lassen = unverändert)')
|
|
->password()
|
|
->revealable()
|
|
->minLength(10)
|
|
->required(fn (string $operation): bool => $operation === 'create')
|
|
->dehydrated(fn (?string $state): bool => filled($state)),
|
|
]);
|
|
}
|
|
}
|