tomatophp / filament-meta
Convert any model on your app to pluggable model using Meta and get ready to use relation manager on FilamentPHP panel
Fund package maintenance!
3x1io
Requires
- php: ^8.1|^8.2
- filament/filament: ^3.2
- genealabs/laravel-model-caching: ^11.0
- tomatophp/console-helpers: ^1.1
Requires (Dev)
- laravel/pint: ^1.18
- livewire/livewire: ^2.10|^3.0
- nunomaduro/larastan: ^2.9
- orchestra/testbench: ^9.5
- pestphp/pest: ^2.36
- pestphp/pest-plugin-laravel: ^2.4
- pestphp/pest-plugin-livewire: ^2.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^1.2
- phpstan/phpstan-phpunit: ^1.4
This package is auto-updated.
Last update: 2025-03-24 14:17:36 UTC
README
Filament Meta Manager
Convert any model on your app to pluggable model using Meta and get ready to use relation manager on FilamentPHP panel
Screenshots
Installation
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 ]; }
Usage
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: 'key',value: 'value');
if you like to set data null to selected key just pass null as value
$user = User::find(1); $user->meta(key: 'key',value: 'null');
the meta accepts array as value
$user = User::find(1); $user->meta(key:'key',value: ['value' => 'value']);
you can set a type for any meta like this
$user = User::find(1); $user->meta(key:'key',value: ['value' => 'value'], type: 'json');
if you like to make the value just string without json input to be indexed you can use key-value
type
$user = User::find(1); $user->meta(key:'key',value: ['value' => 'value'], type: 'key-value');
then your data will be saved to column key_value
not in value
column
you can make a time series of meta by set a date and time on your meta
$user = User::find(1); $user->meta(key:'key',value: ['value' => 'value'], date: '2023-10-01', time: '12:00:00');
if you use the meta for api response or save form data you can have a response
and it can be anything you like be default it's ok
$user = User::find(1); $user->meta(key:'key',value: ['value' => 'value'], response: 'ok');
Use Global Hepler
you can use Meta without any users or models, just use this helper
meta(key: 'key',value: 'value');
it will return the value of the key if exists, otherwise it will create it for you
Disable Create New meta
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 ];
Publish Assets
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"
Testing
if you like to run PEST
testing just use this command
composer test
Code Style
if you like to fix the code style just use this command
composer format
PHPStan
if you like to check the code by PHPStan
just use this command
composer analyse
Other Filament Packages
Checkout our Awesome TomatoPHP