refactoring into clusters
This commit is contained in:
1 parent
042a5a8b58
commit
48deb69379
97 files changed
+186
-198
No files matched your search
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users\Schemas;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
||||
class UserForm
|
||||
{
|
||||
public User $user;
|
||||
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Benutzerkonto')
|
||||
->icon('lucide-user')
|
||||
->schema([
|
||||
Select::make('gender')
|
||||
->prefixIcon('phosphor-gender-neuter')
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required(),
|
||||
TextInput::make('name')
|
||||
->prefixIcon('phosphor-user')
|
||||
->required(),
|
||||
TextInput::make('email')->email()
|
||||
->required()
|
||||
->prefixIcon('phosphor-envelope')
|
||||
->label('E-Mail'),
|
||||
TextInput::make('password')
|
||||
->label('Passwort')
|
||||
->password()
|
||||
->revealable()
|
||||
->prefixIcon('phosphor-lock')
|
||||
->dehydrated(fn ($state): bool => filled($state))
|
||||
->dehydrateStateUsing(fn ($state): string => Hash::make($state))
|
||||
->same('password_confirmation')
|
||||
->rule(Password::min(8)
|
||||
->mixedCase()
|
||||
->numbers()
|
||||
->symbols()
|
||||
->uncompromised())
|
||||
->label('Password'),
|
||||
TextInput::make('password_confirmation')
|
||||
->label('Passwort Bestätigen')
|
||||
->prefixIcon('phosphor-lock')
|
||||
->password()
|
||||
->dehydrated(false)
|
||||
->same('password')
|
||||
->revealable(),
|
||||
Checkbox::make('agb_akzeptiert')
|
||||
->default(false)
|
||||
->label('Allgemeinen Geschäftsbedinnungen akzeptieren')
|
||||
->accepted()
|
||||
->validationMessages([
|
||||
'accepted' => 'Das Akzeptieren der Allgemeinen Geschäftsbedingungen ist erforderlich.',
|
||||
]),
|
||||
Select::make('roles')
|
||||
->label('Rollen')
|
||||
->prefixIcon('phosphor-gear')
|
||||
->aboveContent('Nur für SuperAdmin sichtbare')
|
||||
->visible(fn () => auth()->user()->hasRole('super_admin'))
|
||||
->relationship('roles', 'name')
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
]),
|
||||
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user