to check your version use:
composer show lara-zeus/bolt
On this page
Create Custom Fields
you can add any custom fields you want that available on the filament core or filament plugins.
for example, we want to allow our users to use rating in the forms: first install the package:
1composer require yepsua/filament-rating-field
create the field using the following command, passing the Fully qualified names of the form component:
1php artisan make:zeus-field \\Yepsua\\Filament\\Forms\\Components\\Rating
Caching
bolt will automatically add the field to the form builder.
there is a cache for ll fields, so remember to flush the key bolt.fields
Customization
check out the contract LaraZeus\Bolt\Fields\FieldsContract
and see all the available methods.
available customizations:
Disabling
you can disable any field temporally by adding:
1public bool $disabled = true;
Field title:
1public function title(): string2{3 return __(class_basename($this));4}
fields options
you can add any options to be shown in the admin page when creating the form
1public static function getOptions(): array2{3 return [4 Toggle::make('options.is_required')->label(__('Is Required')),5 ];6}
and to apply these options to the field:
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 options tab
if your field doesn't have any options you can disable the options tab by removing the method getOptions
, or return false:
1public function hasOptions(): bool2{3 return false;4}
view the response
you can control how to present the response in the entries pages
1public function getResponse($field, $resp): string2{3 return $resp->response;4}