<?php
declare (strict_types = 1);

namespace app\index\model;

use app\common\model\SysConfigBaseModel;
use think\model\concern\SoftDelete;

/**
 * 系统配置模型
 * @mixin \think\Model
 */
class SysConfigModel extends SysConfigBaseModel
{
    // 启用软删除
    use SoftDelete;
    // 软删除字段
    protected $deleteTime = 'deleted_at';

    // 关联分组
    public function group()
    {
        return $this->belongsTo(SysConfigGroupModel::class, 'group_id', 'id');
    }

    // 所属名称标识范围查询
    public function scopeByName($query, $name)
    {
        $query->where('name', '=', $name);
    }
}
