123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\common\model;
- use think\Db;
- use think\Model;
- /**
- * 群组
- */
- class OfflineTypeModel extends BaseModel
- {
- // 表名
- protected $name = 'offline_type';
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected int $is_status_search = 1;// 默认使用 status = 1 筛选
- protected int $is_delete_search = 0;// 默认使用 is_delete = 0 筛选
- /**
- * 默认查询字段
- *
- * @var array|string[]
- */
- public array $select = [
- '*'
- ];
- public function searchIsHomeAttribute($query, $value, array $params)
- {
- if (!in_array($value,[0,1])) {
- return $query;
- }
- return $query->where('is_home', $value);
- }
- }
|