Looking to hire Laravel developers? Try LaraJobs

laravel-tags maintained by oleaass

Description
Add tags to any Laravel project
Author
Last update
2021/08/20 01:12 (dev-dev)
License
Links
Downloads
5

Comments
comments powered by Disqus

Add tags to Eloquent models in Laravel

This package allows you to easily add tags to any Eloquent model you have in your Laravel application

$post = \App\Models\Post::create([
    'title' => 'My first post'
]);

$tag = \OleAass\Tags\Models\Tag::create([
    'name' => 'My tag'
]);

$post->tags()->attach([$tag->id]);

Installation

$ composer require oleaass/laravel-tags
$ php artisan migrate # This will create two new database tables 'tags' & 'taggables'

Add tags to your Eloquent model

namespace App\Models;

use OleAass\Tags\Taggable;

class Post extends Model
{
    use Taggable;
}