ValentinC
how to fill form at simple page
do you have components/layouts/app.blade file?
mine has this content:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? 'Page Title' }}</title>
@vite(['resources/css/app.scss', 'resources/js/app.js'])
</head>
<body>
{{ $slot }}
@livewireScriptConfig
</body>
</html>
33 replies
how to fill form at simple page
Here is my code :
<?php
namespace App\Livewire;
use Carbon\Carbon;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Illuminate\Support\Str;
use Livewire\Component;
class RegisterUserAndCarForm extends Component implements HasForms
{
use InteractsWithForms;
public ?array $data = [];
public ?string $title = null;
public function mount(): void
{
$this->form->fill([
'title' => 'text',
]);
}
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('title')
->required(),
])
->statePath('data');
}
public function render()
{
return view('livewire.register-user-and-car-form');
}
}
33 replies