Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Nova Tags Field

Nova Tags Field Laravel Package

spatie/nova-tags-field

Nova field for tagging resources using spatie/laravel-tags. Add the HasTags trait to your Eloquent models and use the Tags field in Nova to create, assign, and manage tags. Requires MySQL 5.7.8+ and installs via Composer.

View on GitHub
Deep Wiki
Context7

A tags field to use in your Nova apps

Frequently asked questions about Nova Tags Field
How do I add a tags field to a Laravel Nova resource?
First, ensure your Eloquent model uses the `HasTags` trait from spatie/laravel-tags. Then, add the `Tags::make('Tags')` field to your Nova resource’s `fields()` method. The package handles the rest, storing tags in the shared `tags` table.
Does spatie/nova-tags-field work with Laravel Nova 4 or 5?
Yes, the package supports both Nova 4.x and 5.x. Always check the package’s documentation for version-specific requirements, as minor updates may align with newer Nova releases. Compatibility is typically maintained for the latest stable Nova versions.
Can I use this package without spatie/laravel-tags already installed?
No, you must install `spatie/laravel-tags` separately as it powers the tagging functionality. Follow the [installation guide](https://spatie.be/docs/laravel-tags/v4/installation-and-setup) to set up the tags table and model before using `spatie/nova-tags-field`.
Will this package slow down Nova if I have thousands of tags?
Performance depends on your database and Nova’s UI. The package uses a pivot-table approach, which is efficient for most use cases. For large datasets, consider indexing the `tags` table or optimizing Nova’s query filters to avoid loading excessive tag data.
Can I customize the tag input UI in Nova?
Basic customization is possible via Nova’s field options, but heavy UI changes may require overriding the package’s Vue.js components. Check the `vendor:publish` command to access the package’s assets for deeper customization.
How do I filter Nova resources by tags?
Use Eloquent’s `whereHas` method in your Nova resource’s `scope` or `query` methods. For example, `return $query->whereHas('tags', function ($query) { $query->where('name', 'like', '%keyword%'); });`. The package ensures tags are queryable via the `HasTags` trait.
Does this package support PostgreSQL?
While `spatie/laravel-tags` supports PostgreSQL, `spatie/nova-tags-field` is primarily tested with MySQL 5.7.8+. PostgreSQL may require adjustments, such as customizing the pivot table schema or handling JSON tag storage if needed.
Can I use this with Laravel 8 or 9?
Yes, the package works with Laravel 8+ as long as your Nova version is compatible. Ensure `spatie/laravel-tags` (v3.x+) is installed, which supports these Laravel versions. Always verify dependencies for version conflicts.
Are there alternatives to spatie/nova-tags-field for Nova tagging?
Yes, alternatives include custom Nova fields using Laravel’s `many-to-many` relationships or packages like `beberlei/laravel-nova-tags`. However, `spatie/nova-tags-field` integrates seamlessly with `spatie/laravel-tags`, offering a mature, feature-rich solution with minimal setup.
How do I test tag functionality in my Nova resource?
Test by creating a Nova resource with the `Tags` field, then verify tag creation, editing, and deletion in the UI. Backend tests should include assertions for Eloquent queries like `model->tags`, `model->tag('name')`, and `whereHas('tags')` to ensure data integrity.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport