12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- declare(strict_types=1);
- namespace App\Model\Arts;
- use App\Master\Enum\RedisKeyEnum;
- use App\Model\Model;
- use App\Utils\RedisUtil;
- use Hyperf\DbConnection\Db;
- class QuestionAnswerModel extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var ?string
- */
- protected ?string $table = 'question_answer';
- protected ?string $dateFormat = 'U';
- public bool $timestamps = false;
- protected int $is_status_search = 1;// 是否使用 1=是 0=否 默认使用 status = 1 筛选
- protected int $is_delete_search = 0;// 是否使用 1=是 0=否 默认使用 is_delete = 0 筛选
- /**
- * 默认查询字段
- *
- * @var array|string[]
- */
- public array $select = [
- '*'
- ];
- public function searchTypeAttribute($query, $value, array $params): mixed
- {
- if (empty($value)) {
- return $query;
- }
- return $query->where('type', $value);
- }
- }
|