Convert any model on your app to pluggable model using Meta and get ready to use relation manager on FilamentPHP panel
composer require tomatophp/filament-meta
after install your package please run this command
php artisan filament-meta:install
on your model you want to use meta on it, just add this trait
use Tomatophp\FilamentMeta\Traits\HasMeta;Â class User extends Model{ use HasMeta;}
now on your Resource you can add meta relation manager like this
 use Tomatophp\FilamentMeta\Filament\RelationManager\MetaRelationManager; public static function getRelations(): array{ return [ MetaRelationManager::class ];}
meta trait add ->meta()
method to your model that you can use to get meta data
$user = User::find(1);$user->meta('key');
if the key not exists it will create it for you, if you like to set data it's very easy
$user = User::find(1);$user->meta('key', 'value');
if you like to set data null to selected key just pass null as value
$user = User::find(1);$user->meta('key', 'null');
the meta accepts array as value
$user = User::find(1);$user->meta('key', ['value' => 'value']);
publish your config using this command
php artisan vendor:publish --tag="filament-meta-config"
then go to config/filament-meta.php
and set create
to false
return [ 'create' => false];
you can publish config file by use this command
php artisan vendor:publish --tag="filament-meta-config"
you can publish views file by use this command
php artisan vendor:publish --tag="filament-meta-views"
you can publish languages file by use this command
php artisan vendor:publish --tag="filament-meta-lang"
you can publish migrations file by use this command
php artisan vendor:publish --tag="filament-meta-migrations"
if you like to run PEST
testing just use this command
composer test
if you like to fix the code style just use this command
composer format
if you like to check the code by PHPStan
just use this command
composer analyse
Checkout our Awesome TomatoPHP