bolt

you are reading the documentation for version v1 our latest version is v3 make sure to select the correct version.
to check your version use: composer show lara-zeus/bolt

Create Custom Fields

Add any custom fields you want that is available on the filament core or filament plugins.

For example, we want to allow our users to use ratings in the forms: First, install the package:

1composer require yepsua/filament-rating-field

Create the field using the following command, passing the fully qualified name of the form component:

1php artisan make:Zeus-field \\Yepsua\\Filament\\Forms\\Components\\Rating

Caching

Bolt will automatically list the field in the form builder. There is a cache for all fields, so remember to flush the key bolt.fields

Customization

check out the contract LaraZeus\Bolt\Fields\FieldsContract and see all the available methods.

Disabling

You can turn off any field temporally by adding:

1public bool $disabled = true;

Field Title:

1public function title(): string
2{
3 return __(class_basename($this));
4}

Field Options

you can add any options to be shown on the admin page when creating the form

1public static function getOptions(): array
2{
3 return [
4 Toggle::make('options.is_required')->label(__('Is Required')),
5 ];
6}

And to apply these options to the field in the frontend:

1public function appendFilamentComponentsOptions($component, $zeusField)
2{
3 parent::appendFilamentComponentsOptions($component, $zeusField);
4 
5 if (isset($zeusField->options['is_required']) && $zeusField->options['is_required']) {
6 $component = $component->required();
7 }
8}

Disable the options tab

if your field doesn't have any options, you can turn off the options tab by removing the method getOptions or returning false:

1public function hasOptions(): bool
2{
3 return false;
4}

View the Response

you can control how to view the response on the entries pages

1public function getResponse($field, $resp): string
2{
3 return $resp->response;
4}

Zeus is an open-source project. Thanks to my sponsors for helping me maintain this project.