PHP code example of packstub / filament-form-builder
1. Go to this page and download the library: Download packstub/filament-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/ */
packstub / filament-form-builder example snippets
use Packstub\FormBuilder\FormBuilderPlugin;
$panel->plugin(FormBuilderPlugin::make());
use Packstub\FormBuilder\Contracts\SubmissionSink;
use Packstub\FormBuilder\Models\FormSubmission;
class PushToCrm implements SubmissionSink
{
public function handle(FormSubmission $submission): void
{
Crm::createLead($submission->form->slug, $submission->data);
}
}
use Filament\Forms\Components\TextInput;
use Packstub\FormBuilder\Fields\Field;
use Packstub\FormBuilder\Fields\Types\NumberField;
class RatingField extends NumberField
{
public static function id(): string
{
return 'rating';
}
public function rules(Field $field): array
{
return ['integer', 'between:1,5'];
}
}