Files
car_info/plugin/admin/app/model/RuleTranslation.php
T

45 lines
1.0 KiB
PHP
Raw Normal View History

2025-05-06 17:16:37 +08:00
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id 主键
* @property integer $rule_id 规则ID
* @property string $lang 语言代码
* @property string $title 翻译标题
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
*/
class RuleTranslation extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_rule_translations';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* 获取规则的翻译标题
* @param int $ruleId 规则ID
* @param string $lang 语言代码
* @return string|null
*/
public static function getTranslatedTitle($ruleId, $lang)
{
$translation = self::where('rule_id', $ruleId)
->where('lang', $lang)
->first();
return $translation ? $translation->title : null;
}
}