Basic Filament field to save data as JSON
| Package Version | Filament Version |
|---|---|
| 1.x | 3.x |
| 2.x | 4.x |
| 3.x | 5.x |
You can install the package via composer:
composer require cube-agency/filament-jsonAdd json column to your table:
$table->json('meta')->nullable();and add this field to your form:
use CubeAgency\FilamentJson\Filament\Forms\Components\Json;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\TagsInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema;
public static function form(Schema $schema): Schema
{
return $schema
->components([
// ...
Json::make('meta')
->schema([
Grid::make()
->schema([
TextInput::make('title'),
TagsInput::make('keywords'),
]),
Grid::make()
->schema([
Textarea::make('description')
->rows(3),
FileUpload::make('image')
->image()
->imagePreviewHeight('64'),
]),
]),
// ...
]);
}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.