PHP code example of tivents / livewire-form-builder
1. Go to this page and download the library: Download tivents/livewire-form-builder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tivents / livewire-form-builder example snippets
use Tivents\LivewireFormBuilder\Contracts\FormRepositoryContract;
use App\Repositories\LivewireFormBuilderRepository;
public function register(): void
{
$this->app->bind(FormRepositoryContract::class, LivewireFormBuilderRepository::class);
}
// In a parent Livewire component
#[On('form-submitted')]
public function onFormSubmitted(int|string|null $formId, array $data): void
{
// New submission — $data contains all field values incl. extra-fields
}
#[On('form-updated')]
public function onFormUpdated(int|string $submissionId, int|string|null $formId, array $data): void
{
// Existing submission was updated
}
#[On('form-saved')]
public function onFormSaved(int|string|null $formId): void
{
// Builder saved/updated a form schema
}