I'm kind of lost. I made a form outside filament and placed it on the landing page. How do I save it in a filament resource when the user hits submit?
ContactForm.php
<?php
namespace App\Livewire;
...
class ContactForm extends Component implements HasForms
{
use InteractsWithForms;
public $email;
public $first_name;
public $last_name;
public $phone;
public $message;
public $comm_method;
protected function getFormSchema(): array
{
return [
Grid::make(2)
->schema([
TextInput::make('first_name')->required(),
TextInput::make('last_name')->required(),
TextInput::make('email')->required(),
TextInput::make('phone'),
Textarea::make('message')
->rows(5)
->cols(20)
->columnSpan('full')
->maxLength(4000),
Radio::make('comm_method')
->label("Preferred Communication Method")
->options([
'email' => 'Email',
'messenger' => 'Messenger',
'viber' => 'Viber',
'whatsapp' => 'Whatsapp',
])
->columnSpan('full'),
]),
];
}
public function create(): void
{
dd($this->form->getState());
}
public function render()
{
return view('livewire.contact-form');
}
}
<?php
namespace App\Livewire;
...
class ContactForm extends Component implements HasForms
I have a form on a landing page that the users fill out and I want to send the form data to be added to a table on a resource instead of doing it in the admin panel. Is it possible to do this in filament?