This library provides a scalable method for tracking tags that are attached to
a eloquent Model
by your app's users. This allows for indexing content based
on how your app's users have tagged the content.
If you're looking for something more basic without user tracking or caching,
please see the fantastic laravel-tagging
by rtconner. Rob's library served as the base
for building this project.
A laravel-repository
package
by Torann is used in this project for its
repositories and caching. Please see his project for additional documentation
on the repositories provided within.
To use this library, you will need at least one repository using Torann's
pattern. This repository will encapsulate whatever Model
your app needs to tag.
I would recommend setting up
and testing this repository before continuing.
All the repositories included are complete with integration tests. The tests also serve as documentation!
composer require dan/laravel-user-tagging "dev-master"
'providers' => array(
'Dan\Tagging\Providers\TaggingServiceProvider',
);
php artisan vendor:publish --provider="Dan\Tagging\Providers\TaggingServiceProvider"
php artisan migrate
After these two steps are done, you can edit config/tagging.php with your preferred settings. You must provide at least one taggable interface in the config.
// Taggable Interfaces for Abstract Taggable Repositories
'taggable_interfaces' => [
'\App\Models\Post' => '\App\Repositories\Posts\PostsInterface'
],
More examples in the documentation
See config/tagging.php for configuration options.
- Dan Richards - http://danrichards.net
- Robert Conner - http://smartersoftware.net
- Daniel Stainback - http://lyften.com