owllog/laravel-taggy

An Eloquent tagging package for Laravel Framework.

Downloads

4

Stars

0

Version

1.0.0

Laravel-Taggy

An Eloquent tagging package for Laravel Framework.

Installation

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

Usage

Add Taggable trait to your models:

Example:
<?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();
Meklad

Author

Meklad