UserTag.php 956 Bytes
<?php

namespace App\Models;

use App\Support\Model;
use App\Traits\JsonColumnDirtyTrait;
use Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class UserTag extends Model
{
    use SoftDeletes, JsonColumnDirtyTrait;

    protected $table = 'user_tags';

    protected $guarded = [];

    protected $casts = ['frame' => 'json'];

    protected $hidden = ['deleted_at'];

    public array $columnMap = [
        'name'         => '名称',
        'icon'         => '图标',
        'weight'       => '权重值',
        'index_filter' => '筛选值',
        'frame'        => '边框',
        'frame->url'   => '边框图标',
        'frame->color' => '边框颜色',
        'status'       => '状态'
    ];

    /**
     * @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}