<?php

namespace IqContent\LaravelFilemanager\Models;

use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;

class IQContentTag extends Model
{
    use Sluggable;

    //use the connection to sec. Datebase sterntours
    protected $connection = 'mysql_stern';

    protected $table = 'i_q_content_tags';

    protected $fillable = [
        'name', 'pos', 'active'
    ];

    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'name'
            ]
        ];
    }

    public function category() {
        return $this->belongsTo('IqContent\LaravelFilemanager\Models\IQContentCategory', 'category_id');
    }

    public function file_tags() {
        return $this->hasMany('IqContent\LaravelFilemanager\Models\IQContentFileTag', 'tag_id');
    }
}
