Downloads
Stars
Version
An Eloquent tagging package for Laravel Framework.
Install the package via composer
$ composer require owllog/laravel-taggy
Add laravel-taggy service provider to config/app.php
/*
* Package Service Providers...
*/
Owllog\LaravelTaggy\LaravelTaggyServiceProvider::class,
Than migrate the new tags tables to database
$ php artisan migrate
Add Taggable trait to your models:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Owllog\LaravelTaggy\Traits\Taggable;
class Lesson extends Model
{
use Taggable;
}
Find Lesson and add tags to it:
$lesson = Lesson::find(38);
$lesson->tag(['velit', 'Rerum', 'dolorem', 'quo']);
To Get A Lesson Tags: [This relation available via taggable trait]
$lesson = \App\Lesson::find(1);
$lesson->tags();