1. Go to this page and download the library: Download putheng/taggy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
putheng / taggy example snippets
Putheng\Taggy\TaggyServiceProvider::class,
php artisan migrate
use Putheng\Taggy\TaggableTrait;
class Lession extends Model {
use TaggableTrait;
}
use App\Lession;
$lession = new Lession;
$lession->title = 'a new lession';
$lession->save();
# name or slug version of value in tags table
$lession->tag(['Laravel', 'php']);
# tag from a collections of model
$tags = Putheng\Taggy\Models\Tag::whereIn('slug', ['php', 'laravel'])->get();
$lession->tag($tags);
# tag from a model
$tag = Putheng\Taggy\Models\Tag::where('name', 'Laravel')->first();
$lession->tag($tag);
# get lessions of any tags from array of tags's slug
$lessions = Lession::withAnyTag(['php', 'laravel']);
# return collection of lession
$lessions->get();
# get lessions of all tags from array of tags's slug
$lessions = Lession::withAllTags(['php', 'laravel']);
# return collection of lession
$lessions->get();
# get lessions that has tags from array of tags's slug
$lessions = Lession::hasTags(['php', 'laravel']);
# return collection of lession
$lessions->get();
use Putheng\Taggy\Models\Tag;
# is greater than or equal to the given value.
$tags = Tag::useGte();
# is greater than to the given value.
$tags = Tag::useGt();
# is less than or equal to the given value.
$tags = Tag::useLte();
# is less than the given value.
$tags = Tag::useLt();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.