<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DistAppearance extends Model
{
    use HasFactory;

    protected $table = 'dist_appearance';

    // 与 DistAppearancePublishList 的反向关联
    public function publishLists()
    {
        return $this->hasMany(DistAppearancePublishList::class, 'appearance_id', 'id');
    }

    /**
     * 根据 ID 返回对应模板信息
     *
     * @param int $id
     * @return self|null
     */
    public static function getTemplateById(int $id)
    {
        return self::find($id); // 根据主键 ID 查找记录
    }
}
