wip
This commit is contained in:
1 parent
5f95289079
commit
60249dffd9
37 files changed
+412
-458
No files matched your search
@@ -2,22 +2,55 @@
|
||||
|
||||
namespace App\Filament\Resources\Users\Schemas;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
||||
class UserForm
|
||||
{
|
||||
public User $user;
|
||||
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name'),
|
||||
Section::make('Benutzerkonto')
|
||||
->icon('lucide-user')
|
||||
->schema([
|
||||
TextInput::make('name')->required(),
|
||||
TextInput::make('email')->email()
|
||||
->required()
|
||||
->label('E-Mail'),
|
||||
]),
|
||||
Section::make('Sicherheit')
|
||||
->icon('lucide-lock')
|
||||
->schema([
|
||||
TextInput::make('password')
|
||||
->label('Passwort')
|
||||
->password() // Masks the input
|
||||
->required()
|
||||
->revealable()
|
||||
->rule(Password::min(8)->mixedCase()->numbers()->symbols()->uncompromised()) // Enforces strong password policies
|
||||
->dehydrateStateUsing(fn ($state) => bcrypt($state)) // Hashes the password before saving
|
||||
->label('Password'),
|
||||
TextInput::make('password_confirmation')
|
||||
->password() // Masks the input
|
||||
->required()
|
||||
->same('password') // Validates that this matches the 'password' field
|
||||
->label('Passwort Bestätigen'),
|
||||
]),
|
||||
|
||||
Select::make('roles')
|
||||
->label('Rolle')
|
||||
->visible(fn () => auth()->user()->hasRole('super_admin'))
|
||||
->relationship('roles', 'name')
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
]);
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user