owllog / laravel-taggy
There is no license information available for the latest version (1.0.0) of this package.
An Eloquent tagging package for Laravel Framework.
1.0.0
2018-12-16 21:20 UTC
Requires
- php: >=7.0
- illuminate/database: >=5.5
- illuminate/support: >=5.5
Requires (Dev)
- fzaninotto/faker: ^1.4
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-09-18 03:09:20 UTC
README
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();