dyfun / tags
There is no license information available for the latest version (1.0) of this package.
Laravel tags package
1.0
2024-04-22 16:22 UTC
This package is not auto-updated.
Last update: 2025-06-30 22:25:20 UTC
README
This package is a simple tag package for Laravel. It allows you to add tags to any model in your Laravel application.
Installation
You can install the package via composer:
composer require dyfun/tags
add the service provider to your config/app.php file:
'providers' => [ ... Dyfun\Tags\TagsServiceProvider::class, ... ];
run
php artisan migrate
Usage
Apply HasTags trait to a model
<?php use Illuminate\Database\Eloquent\Model; use Dyfun\Tags\HasTags; class File extends Model { use HasTags; ... }
Example:
$file = File::find(1); $file->attachTag("apple"); $file->attachTags(["apple", "orange", "watermelon"]); $file->detachTag("apple"); $file->detachTags(["apple", "orange"]);