public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
Forms\Components\TextInput::make('email')
->email()
->required()
->maxLength(255),
Forms\Components\TextInput::make('password')
->password()
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->dehydrated(fn ($state) => filled($state))
->required(fn (string $context): bool => $context === 'create'),
Forms\Components\TextInput::make('balance')
->label('Starting Balance')
->required()
->numeric()
->hidden(fn (string $context): bool => $context !== 'create')
->default(0),
Forms\Components\TextInput::make('percentage_discount')
->required()
->numeric()
->default(0),
Forms\Components\TextInput::make('fixed_discount')
->required()
->numeric()
->default(0),
]);
}
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['role'] = 1;
return $data;
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
Forms\Components\TextInput::make('email')
->email()
->required()
->maxLength(255),
Forms\Components\TextInput::make('password')
->password()
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->dehydrated(fn ($state) => filled($state))
->required(fn (string $context): bool => $context === 'create'),
Forms\Components\TextInput::make('balance')
->label('Starting Balance')
->required()
->numeric()
->hidden(fn (string $context): bool => $context !== 'create')
->default(0),
Forms\Components\TextInput::make('percentage_discount')
->required()
->numeric()
->default(0),
Forms\Components\TextInput::make('fixed_discount')
->required()
->numeric()
->default(0),
]);
}
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['role'] = 1;
return $data;
}