This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
You can install the package via composer:
composer require coolsam/visual-forms
php artisan visual-forms:install
Follow the installation instructions to:
- publish the config file
- publish the migrations
- run the migrations (Optional)
You can run the above steps manually by running the following commands:
To publish the migrations and run them
php artisan vendor:publish --tag="visual-forms-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="visual-forms-config"
This is the contents of the published config file:
return [
'tables' => [
'visual_forms' => env('VISUAL_FORMS_TABLE', 'visual_forms'),
'visual_form_fields' => env('VISUAL_FORM_FIELDS_TABLE', 'visual_form_fields'),
'visual_form_entries' => env('VISUAL_FORM_ENTRIES_TABLE', 'visual_form_entries'),
],
'models' => [
'visual_form' => env('VISUAL_FORM_MODEL', \Coolsam\VisualForms\Models\VisualForm::class),
'visual_form_field' => env('VISUAL_FORM_FIELD_MODEL', \Coolsam\VisualForms\Models\VisualFormField::class),
'visual_form_entry' => env('VISUAL_FORM_ENTRY_MODEL', \Coolsam\VisualForms\Models\VisualFormEntry::class),
],
];
- Register the VisualFormsPlugin in your AdminServiceProvider
use Coolsam\VisualForms\Filament\VisualFormsPlugin;
// in your register method
$panel->plugin(VisualFormsPlugin::class);
The above command will register the VisualForms resource for managing forms from your backend.
- In any of your forms, use the created form's schema to render it
use Coolsam\VisualForms\Models\VisualForm;
// in your form's schema
public function form(Form $form)
{
$recordId = 1;
$formModel = VisualForm::find($recordId);
return $form->schema($formModel->schema());
}
- To save the form's response payload, execute the following method in your action method:
use Coolsam\VisualForms\Models\VisualForm;
// in your form's action method e.g create()
public function create(Request $request, VisualForm $record)
{
$data = $this->form->getState();
$record->recordSubmission($data, isProcessed: false);
// TODO: you can send this payload wherever else you want, even to a webhook for further processing
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.