<?php

namespace Modules\Cms\Traits;

use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Modules\Cms\Models\Tag;
use Modules\Cms\Models\Taggable;

trait HasTags
{

    /**
     * Notes   : 拥有内容标签
     * @Date   : 2021/4/25 12:58 下午
     * @Author : < Jason.C >
     * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
     */
    public function tags(): MorphToMany
    {
        return $this->morphToMany(Tag::class, 'taggable', 'cms_taggable')
                    ->using(Taggable::class)
                    ->withTimestamps();
    }

}