.orelyus
.orelyus
FFilament
Created by .orelyus on 9/6/2023 in #❓┊help
Table row doesn't take up the whole width
No description
11 replies
FFilament
Created by .orelyus on 9/6/2023 in #❓┊help
Saving forms data to resource
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
{
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');
}
}
5 replies
FFilament
Created by .orelyus on 8/23/2023 in #❓┊help
Send form data from landing page to admin panel
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?
6 replies