PHP code example of nickdekruijk / taggable

1. Go to this page and download the library: Download nickdekruijk/taggable 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/ */

    

nickdekruijk / taggable example snippets




namespace App;

use Illuminate\Database\Eloquent\Model;
use NickDeKruijk\Taggable\Taggable;

class Product extends Model
{
    use Taggable;

        'tags' => [
            'view' => 'admin::model',
            'icon' => 'fa-tags',
            'model' => 'NickDeKruijk\Taggable\Tag',
            'index' => 'title',
            'active' => 'active',
            'orderBy' => 'sort',
            'sortable' => true,
            'treeview' => 'parent',
            'columns' => [
                'active',
                'title',
            ],
        ],

                'tags' => [
                    'type' => 'pivot',
                    'model' => 'NickDeKruijk\Taggable\Tag',
                    'morph' => 'taggable',
                    'scope' => 'getTree',
                    'columns' => 'title',
                    'treeview' => 'parent',
                ],
bash
php artisan vendor:publish --tag=config --provider="NickDeKruijk\Taggable\ServiceProvider"
bash
php artisan migrate