<?php

namespace kernel\app_modules\tag\models;

use Illuminate\Database\Eloquent\Model;

/**
 * @property int $id
 * @property int $tag_id
 * @property string $entity
 * @property int $entity_id
 */
class TagEntity extends Model
{
    protected $table = 'tag_entity';

    protected $fillable = ['tag_id', 'entity', 'entity_id'];

    public static function labels(): array
    {
        return [
            'tag_id' => 'тег',
            'entity' => 'Сущность',
            'entity_id' => 'Идентификатор сущности',
        ];
    }

    public function tag(): \Illuminate\Database\Eloquent\Relations\BelongsTo
    {
        return $this->belongsTo(Tag::class);
    }
}