Skip to content
JavaabuPublic

About

Meta fields for Eloquent models, defined with stencil, efficient to query with scopes, extensible with custom field types, optionally translatable

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Meta

Tests codecov Latest Version on Packagist License: MIT

Meta fields for Eloquent models:

  • Defining: define them once with javaabu/stencil fields.
  • Storing: values are stored in typed, indexed columns.
  • Querying: whereMeta and orderByMeta filter 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} />

Documentation

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.

Testing

composer test                        # SQLite
DB_CONNECTION=mysql composer test    # MySQL

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@javaabu.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Meta fields for Eloquent models, defined with stencil, efficient to query with scopes, extensible with custom field types, optionally translatable

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages