Add touch-ready Filament login and admin update tooling
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Users;
|
||||
|
||||
use App\Models\User;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
@@ -16,7 +17,6 @@ use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
use BackedEnum;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
@@ -50,6 +50,20 @@ class UserResource extends Resource
|
||||
->dehydrated(fn (?string $state): bool => filled($state))
|
||||
->required(fn (string $operation): bool => $operation === 'create')
|
||||
->maxLength(255),
|
||||
TextInput::make('admin_pin_hash')
|
||||
->label('Admin PIN')
|
||||
->password()
|
||||
->revealable()
|
||||
->dehydrateStateUsing(fn (?string $state): ?string => filled($state) ? bcrypt($state) : null)
|
||||
->dehydrated(fn (?string $state): bool => filled($state))
|
||||
->afterStateHydrated(function (TextInput $component): void {
|
||||
$component->state(null);
|
||||
})
|
||||
->nullable()
|
||||
->rule('regex:/^\\d+$/')
|
||||
->minLength(4)
|
||||
->maxLength(8)
|
||||
->helperText('Leave blank to keep the current PIN.'),
|
||||
Select::make('role_id')
|
||||
->label(__('filament.resource.user.form.role'))
|
||||
->relationship('role', 'name')
|
||||
|
||||
Reference in New Issue
Block a user