1. Go to this page and download the library: Download lecturize/laravel-tags 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/ */
lecturize / laravel-tags example snippets
" "lecturize/laravel-tags": "^1.0"
}
namespace App\Models;
use Lecturize\Tags\Traits\HasTags;
class Post extends Model
{
use HasTags;
// ...
}
$tags = $model->tags();
$tags = $model->hasTag('Check');
$tags = $model->tag('My First Tag');
$tags = $model->tag(['First', 'Second', 'Third']);
$tags = $model->untag('Remove');
$tags = $model->retag('A New Tag');
$tags = $model->retag(['Fourth', 'Fifth', 'Sixth']);
$tags = $model->detag();
$tags = $model->listTags();
$posts = Post::withTag('My First Tag')->get();
$posts = Post::withTags(['First', 'Second', 'Third'])->get();