oleaass/laravel-tags

Add tags to any Laravel project

Downloads

4

Stars

0

Version

v1.0.0

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;
}
oleaass

Author

oleaass