catchAdmin/extend/catcher/base/CatchModel.php
2021-04-20 08:45:08 +08:00

52 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace catcher\base;
use catcher\CatchQuery;
use catcher\traits\db\BaseOptionsTrait;
use catcher\traits\db\RewriteTrait;
use catcher\traits\db\TransTrait;
use think\model\concern\SoftDelete;
use catcher\traits\db\ScopeTrait;
/**
*
* @mixin CatchQuery
* Class CatchModel
* @package catcher\base
*/
abstract class CatchModel extends \think\Model
{
use SoftDelete, TransTrait, BaseOptionsTrait, ScopeTrait, RewriteTrait;
protected $createTime = 'created_at';
protected $updateTime = 'updated_at';
protected $deleteTime = 'deleted_at';
protected $defaultSoftDelete = 0;
protected $autoWriteTimestamp = true;
// 分页 Limit
public const LIMIT = 10;
// 开启
public const ENABLE = 1;
// 禁用
public const DISABLE = 2;
/**
* 是否有 field
*
* @time 2020年11月23日
* @param string $field
* @return bool
*/
public function hasField(string $field)
{
return property_exists($this, 'field') && in_array($field, $this->field);
}
}