PHP code example of oleaass / laravel-tags
1. Go to this page and download the library: Download oleaass/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/ */
oleaass / laravel-tags example snippets
$post = \App\Models\Post::create([
'title' => 'My first post'
]);
$tag = \OleAass\Tags\Models\Tag::create([
'name' => 'My tag'
]);
$post->tags()->attach([$tag->id]);
namespace App\Models;
use OleAass\Tags\Taggable;
class Post extends Model
{
use Taggable;
}