mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +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\Select;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Widgets\Widget;
|
||||
|
||||
@ -27,24 +28,25 @@ public function mount(Project $project): void
|
||||
$this->project = $project;
|
||||
}
|
||||
|
||||
public function getFormSchema(): array
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return [
|
||||
Section::make()
|
||||
->heading('Add User')
|
||||
->schema([
|
||||
Select::make('user')
|
||||
->name('user')
|
||||
->options(fn () => User::query()->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->rules(\App\Actions\Projects\AddUser::rules($this->project)['user']),
|
||||
])
|
||||
->footerActions([
|
||||
Action::make('add')
|
||||
->label('Add')
|
||||
->action(fn () => $this->submit()),
|
||||
]),
|
||||
];
|
||||
return $form
|
||||
->schema([
|
||||
Section::make()
|
||||
->heading('Add User')
|
||||
->schema([
|
||||
Select::make('user')
|
||||
->name('user')
|
||||
->options(fn () => User::query()->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->rules(\App\Actions\Projects\AddUser::rules($this->project)['user']),
|
||||
])
|
||||
->footerActions([
|
||||
Action::make('add')
|
||||
->label('Add')
|
||||
->action(fn () => $this->submit()),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function submit(): void
|
||||
|
Reference in New Issue
Block a user