Meta fields for Eloquent models:
- Defining: define them once with javaabu/stencil fields.
- Storing: values are stored in typed, indexed columns.
- Querying:
whereMetaandorderByMetafilter and sort by them, and eager loading avoids N+1s. - Editing: edit them in a form rendered with Blade or Inertia React.
- Extending: add your own types.
- Translating: translate them with javaabu/translatable.
MetaFields::for(Post::class, [
TextInput::make('subtitle')->maxLength(255)->thaana()->translatable(),
Checkbox::make('featured'),
DatePicker::make('event_date'),
]);class Post extends Model
{
use HasMeta;
}
$post->setMeta(['subtitle' => 'ރާއްޖޭގެ ޚަބަރު', 'featured' => true]);
$post->getMeta('subtitle');
Post::whereMeta('featured', true)->whereMeta('event_date', '>=', today())->orderByMeta('event_date')->with('meta')->paginate();
MetaForm::for($post)->action(route('posts.meta.update', $post)); // {{ $form }} or <StencilForm schema={form} />You'll find the documentation on https://docs.javaabu.com/meta, and in the docs folder.
AI coding assistants can start from llms.txt. The package ships a Laravel Boost skill and guideline, which Boost finds by itself. See AI assistants.
composer test # SQLite
DB_CONNECTION=mysql composer test # MySQLPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email info@javaabu.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.