mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
[2.x] [Filament] Update deprecated getFormSchema
method to use form()
override (#354)
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Widgets\Widget;
|
||||
|
||||
@ -33,36 +34,37 @@ public function mount(): void
|
||||
$this->timezone = auth()->user()->timezone;
|
||||
}
|
||||
|
||||
public function getFormSchema(): array
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
$rules = UpdateUserProfileInformation::rules(auth()->user());
|
||||
|
||||
return [
|
||||
Section::make()
|
||||
->heading('Profile Information')
|
||||
->description('Update your account\'s profile information and email address.')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Name')
|
||||
->rules($rules['name']),
|
||||
TextInput::make('email')
|
||||
->label('Email')
|
||||
->rules($rules['email']),
|
||||
Select::make('timezone')
|
||||
->label('Timezone')
|
||||
->searchable()
|
||||
->options(
|
||||
collect(timezone_identifiers_list())
|
||||
->mapWithKeys(fn ($timezone) => [$timezone => $timezone])
|
||||
)
|
||||
->rules($rules['timezone']),
|
||||
])
|
||||
->footerActions([
|
||||
Action::make('save')
|
||||
->label('Save')
|
||||
->action(fn () => $this->submit()),
|
||||
]),
|
||||
];
|
||||
return $form
|
||||
->schema([
|
||||
Section::make()
|
||||
->heading('Profile Information')
|
||||
->description('Update your account\'s profile information and email address.')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Name')
|
||||
->rules($rules['name']),
|
||||
TextInput::make('email')
|
||||
->label('Email')
|
||||
->rules($rules['email']),
|
||||
Select::make('timezone')
|
||||
->label('Timezone')
|
||||
->searchable()
|
||||
->options(
|
||||
collect(timezone_identifiers_list())
|
||||
->mapWithKeys(fn ($timezone) => [$timezone => $timezone])
|
||||
)
|
||||
->rules($rules['timezone']),
|
||||
])
|
||||
->footerActions([
|
||||
Action::make('save')
|
||||
->label('Save')
|
||||
->action(fn () => $this->submit()),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function submit(): void
|
||||
|
Reference in New Issue
Block a user