- How do I install escolalms/tags in a Laravel application?
- Install it with Composer by running composer require escolalms/tags. Laravel's package auto-discovery should register the service provider. Then publish and review any package configuration or migration files as described in the README, and run your migrations.
- What does polymorphic tagging mean in this Laravel tags package?
- Polymorphic tagging lets a single tag be attached to multiple model types, such as posts, videos, or courses, through an Eloquent polymorphic relationship. The package stores tag records and taggable associations so models can share the same reusable tags. This keeps tag data consistent instead of duplicating tag names per model.
- How do I attach a tag to a model with escolalms/tags?
- Use the tag management helpers or relationship methods provided by the package to create or assign tags to a model. The package is designed for reusable tags and polymorphic associations, so the same tag can be attached to different model types. Check the README for the exact method names and relationship setup for your models.
- Can I filter Eloquent records by tag using query scopes?
- Yes. The package provides query scopes for filtering records by tag, so you can constrain an Eloquent query to records associated with a given tag. You can chain those scopes with your normal where clauses, eager loading, and pagination.
- Can I configure the tag model and database table names?
- Yes. The package supports configurable models and tables so it can fit an existing schema. Review the published configuration and point the package at your tag model or table names where appropriate. Make sure the expected columns and polymorphic relationships match the package's requirements.
- Which Laravel versions are supported by escolalms/tags?
- The overview does not list specific Laravel or PHP version constraints. Check the package composer.json and README for the supported Laravel versions before installing. That will confirm compatibility with your application's framework and PHP versions.
- Is escolalms/tags safe to use in a production Laravel app?
- It is a lightweight package built around standard Laravel Eloquent relationships and query scopes. Before production use, review its maintenance status, test coverage, and version constraints, and add appropriate database indexes for your taggable queries. Also confirm that the package's configuration and migration strategy match your deployment process.
- How do I write tests for tagging with this package?
- Use Laravel's testing tools with a test database and the RefreshDatabase trait. Create model instances, attach tags through the package's helpers or relationships, and assert that the relationship and tag-filtering scopes return the expected records. Review the package's own tests and README examples for the exact setup it expects.
- How does escolalms/tags compare with spatie/laravel-tags?
- Both packages address tagging in Laravel, but spatie/laravel-tags is a widely used general-purpose option with a broad feature set. escolalms/tags is a lightweight EscolaLMS package focused on reusable polymorphic tags, configurable models and tables, and query scopes. Choose based on your required features, Laravel version compatibility, and maintenance expectations.
- How should I manage tag renaming and deletion without breaking tagged records?
- Use the package's tag management helpers to create and update tag records centrally so assignments stay consistent. Before deleting a tag, decide whether related taggable associations should be detached or left to database constraints, and confirm how the package's tables handle foreign keys. Test the behavior in a staging environment before applying it to production data.