Skip to content

Latest commit

 

History

History
97 lines (70 loc) · 2.93 KB

README.md

File metadata and controls

97 lines (70 loc) · 2.93 KB

Filament Forms

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Filament plugin and package that allows the creation of forms via the admin panel for collecting user data on the front end. Forms are composed of filament field components and support all Laravel validation rules. Form responses can be rendered on the front end of exported to .csv.

Requirements

Dependencies

Installing the Filament Forms Package

Install the plugin via Composer:

composer require tapp/filament-form-builder

public and run migrations with

php artisan vendor:publish --tag="filament-form-builder-migrations"

Optional: Publish the package's views, translations, and config

You can publish the view file with:

php artisan vendor:publish --tag="filament-form-builder-views"

You can publish the config file with:

php artisan vendor:publish --tag="filament-form-builder-config"

Adding the plugin to a panel

Add this plugin to a panel on plugins() method (e.g. in app/Providers/Filament/AdminPanelProvider.php).

use Tapp\FilamentFormBuilder\FilamentFormBuilderPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FilamentFormBuilderPlugin::make(),
            //...
        ]);
}

Configuring Tailwind:

Add this to your tailwind.config.js content section:

    content: [
        ...
        "./vendor/tapp/**/*.blade.php",
    ],

Disabling Redirect

You can disable the redirect when including the Form/Show component inside of another component by passing the 'blockRedirect' prop as follows

    @livewire('tapp.filament-form-builder.livewire.filament-form.show', ['form' => $test->form, 'blockRedirect' => true])

Events

The FilamentForm/Show component emits an 'entrySaved' event when a form entry is saved. You can handle this event in a parent component to as follows.

class ParentComponent extends Component
{
    protected $listeners = ['entrySaved'];

    public function entrySaved(FilamentFormUser $survey)
    {
        // custom logic you would like to add to form entry saving logic
    }
}