ctf0/tagos

This package is abandoned and no longer maintained. No replacement package was suggested.

GUI to manage tags in laravel based on spatie/laravel-tags

Fund package maintenance!
ctf0

Installs: 23

Dependents: 0

Suggesters: 0

Security: 0

Stars: 14

Watchers: 3

Forks: 1

Open Issues: 0

Language:Vue

v1.3.1 2020-12-01 16:01 UTC

This package is auto-updated.

Last update: 2023-01-03 23:34:58 UTC


README

A Tag Editor and Selector based on spatie/laravel-tags.

Editor

41531521-de565f66-72f3-11e8-8a2a-e07ea1002e1b.png

Selector

38068467-9407081a-3311-11e8-83a5-eea196fb00e3.png

  • package requires Laravel v5.5+

Installation

  • composer require ctf0/tagos

  • publish the package assets with

    php artisan vendor:publish --provider="ctf0\Tagos\TagosServiceProvider"
    php artisan vendor:publish --provider="Spatie\Tags\TagsServiceProvider" --tag="migrations"

  • after installation, run php artisan tagos:setup to add

    • package routes to routes/web.php
    • package assets compiling to webpack.mix.js
  • install dependencies

    yarn add vue vue-awesome@v2 vue-notif vue-tippy@v2 axios fuse.js
  • add this one liner to your main js file and run npm run watch to compile your js/css files.

    • if you are having issues Check
    // app.js
    
    window.Vue = require('vue')
    
    require('../vendor/Tagos/js/manager')
    
    new Vue({
        el: '#app'
    })

Features

  • tags editor & selector.

  • show tag suggestion as you type.

  • easily add new tag name & type.

  • show tagged items by tag & by type.

  • search for tags by name in tags index.

  • shortcuts

    interactions keyboard mouse (click)
    show all tags (input) 2x
    add new tag enter *
    hide tags list esc anywhere

Usage

  • migrate the tags table with php artisan migrate

  • there is also a seeder to quickly get you going

    // database/seeds/DatabaseSeeder.php
    
    class DatabaseSeeder extends Seeder
    {
        /**
         * Run the database seeds.
         */
        public function run()
        {
            //...
    
            $this->call(TagsTableSeeder::class);
        }
    }
  • add HasTags trait to your model ex.post

    use ctf0\Tagos\Traits\HasTags;
    use Illuminate\Database\Eloquent\Model;
    
    class Post extends Model
    {
        use HasTags;
    }

Get All tags

app('cache')->get('tagos');

Attaching Tags

  • show the tag selector

    • ex.posts create view

      @include('Tagos::partials.add')
    • ex.posts edit view

      @include('Tagos::partials.add', ['old' => app('tagos')->getModelTags($post)])
  • save the tags

    • store()

      $model = Post::create([...]);
      
      app('tagos')->saveTags($model, $request);
    • update()

      $model = Post::find($id)->update([...]);
      
      app('tagos')->saveTags($model, $request);

Display Model Tags

@include('Tagos::partials.display', [
    'tags' => $post->tags,
    'showType' => true // whether to show the tag type or not
])

Routes

Method URL Name Action
GET tags/editor tagos.editor \ctf0\Tagos\Controllers\TagosController@editor
GET tags tagos.index \ctf0\Tagos\Controllers\TagosController@index
GET tags/type/{type} tagos.index_type \ctf0\Tagos\Controllers\TagosController@indexByType
GET tags/{slug} tagos.show \ctf0\Tagos\Controllers\TagosController@show
GET tags/type/{type}/tag/{slug} tagos.show_type \ctf0\Tagos\Controllers\TagosController@showByType