You can install the package via composer:
composer require spatie/laravel-tags
You can publish the migration with:
php artisan vendor:publish --provider="Spatie\Tags\TagsServiceProvider" --tag="tags-migrations"
After the migration has been published you can create the tags
and taggables
tables by running the migrations:
php artisan migrate
You can optionally publish the config file with:
php artisan vendor:publish --provider="Spatie\Tags\TagsServiceProvider" --tag="tags-config"
This is the contents of the published config file:
return [
'slugger' => null,
'tag_model' => Spatie\Tags\Tag::class,
'taggable' => [
'table_name' => 'taggables',
'morph_name' => 'taggable',
'class_name' => Illuminate\Database\Eloquent\Relations\MorphPivot::class,
]
];