addMeta() macro and HasMeta trait provide a clean abstraction for Eloquent models, reducing boilerplate for metadata-heavy applications.addMeta() to existing tables is straightforward, though it may require downtime or a zero-downtime migration strategy (e.g., adding a new column alongside the old schema).whereHas, with) without breaking existing patterns. However, querying metadata directly (e.g., filtering by metadata values) may require raw SQL or custom scopes.getMetaConfig() to enforce validation or default values.json_encode limits). Input validation and normalization are critical.whereMetaKeyLike). Custom scopes or raw SQL may be required, adding complexity.metadata table (normalized) or a NoSQL backend (e.g., Redis) better suit scalability or querying needs?jsonb vs. MySQL’s JSON).NovaResourceHasMeta, FilamentResourceHasMeta traits).Post, Product, UserProfile).Post) to test integration, performance, and developer experience.addMeta() to the migration and use HasMeta to the model. Publish views/lang if needed:
composer require novius/laravel-meta
php artisan vendor:publish --provider="Novius\LaravelMeta\LaravelMetaServiceProvider" --tag=lang
php artisan vendor:publish --provider="Novius\LaravelMeta\LaravelMetaServiceProvider" --tag=views
getMetaConfig() for model-specific defaults (e.g., SEO fallbacks, image paths):
public function getMetaConfig(): MetaModelConfig {
return MetaModelConfig::make()
->setFallbackTitle('title')
->setOgImageDisk('public');
}
meta column alongside the old schema).$model->meta or dynamic properties (e.g., $model->seo_title).whereHas, with, or relationships remain unchanged.*_meta table by default (e.g., posts_meta). Ensure this aligns with naming conventions and backup strategies.@include('laravel-meta::meta')) for dynamic metadata rendering.getMetaConfig), and troubleshooting tips for the team.model_id and metadata keys.How can I help you explore Laravel packages today?