class VolunteerSettings extends Page implements HasForms
{
use InteractsWithFormActions;
use InteractsWithForms;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.volunteer-settings';
protected static ?string $slug = 'vrijwilligervoorkeuren';
protected static ?string $title = 'Vrijwilligervoorkeuren';
public ?array $data = [];
public function mount()
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form
->model(auth()->user())
->schema([
Forms\Components\Section::make()
->relationship('volunteerProfile')
->schema([
'is_active' => Forms\Components\Toggle::make('is_active')
->label('Actief profiel')
->default(false)
->live(),
// ...
]),
])
->statePath('data');
}
public function getFormActions(): array
{
return [
Actions\Action::make('submit')
->label('Opslaan')
->submit('submit'),
];
}
public function submit()
{
$data = $this->form->getState();
dd($data, $this->data);
}
}
class VolunteerSettings extends Page implements HasForms
{
use InteractsWithFormActions;
use InteractsWithForms;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.volunteer-settings';
protected static ?string $slug = 'vrijwilligervoorkeuren';
protected static ?string $title = 'Vrijwilligervoorkeuren';
public ?array $data = [];
public function mount()
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form
->model(auth()->user())
->schema([
Forms\Components\Section::make()
->relationship('volunteerProfile')
->schema([
'is_active' => Forms\Components\Toggle::make('is_active')
->label('Actief profiel')
->default(false)
->live(),
// ...
]),
])
->statePath('data');
}
public function getFormActions(): array
{
return [
Actions\Action::make('submit')
->label('Opslaan')
->submit('submit'),
];
}
public function submit()
{
$data = $this->form->getState();
dd($data, $this->data);
}
}