12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\common\model;
- use think\Db;
- use think\Model;
- /**
- * 教练标签
- */
- class CoachTag extends Model
- {
- // 表名
- protected $name = 'coach_tag';
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- // 追加属性
- protected $append = [
- 'name_text',
- ];
- public function getNameTextAttr($value,$data)
- {
- $lang = 'en';
- return $lang == 'en' ? $data['name_en'] : $data['name'];
- }
- }
|