catchAdmin/extend/catcher/base/CatchModel.php

52 lines
1.1 KiB
PHP
Raw Normal View History

2019-12-06 09:17:40 +08:00
<?php
2020-11-29 09:29:14 +08:00
declare(strict_types=1);
2019-12-06 09:17:40 +08:00
namespace catcher\base;
2020-02-06 12:02:38 +08:00
use catcher\CatchQuery;
2019-12-06 09:17:40 +08:00
use catcher\traits\db\BaseOptionsTrait;
2020-12-27 12:33:30 +08:00
use catcher\traits\db\RewriteTrait;
2019-12-06 09:17:40 +08:00
use catcher\traits\db\TransTrait;
use think\model\concern\SoftDelete;
2020-06-21 10:50:05 +08:00
use catcher\traits\db\ScopeTrait;
2019-12-06 09:17:40 +08:00
2020-02-06 12:02:38 +08:00
/**
*
* @mixin CatchQuery
* Class CatchModel
* @package catcher\base
*/
2019-12-12 09:14:08 +08:00
abstract class CatchModel extends \think\Model
2019-12-06 09:17:40 +08:00
{
2020-12-27 12:33:30 +08:00
use SoftDelete, TransTrait, BaseOptionsTrait, ScopeTrait, RewriteTrait;
2019-12-06 09:17:40 +08:00
2019-12-07 17:31:38 +08:00
protected $createTime = 'created_at';
2019-12-06 09:17:40 +08:00
2019-12-07 17:31:38 +08:00
protected $updateTime = 'updated_at';
2019-12-06 09:17:40 +08:00
2019-12-07 17:31:38 +08:00
protected $deleteTime = 'deleted_at';
2019-12-06 09:17:40 +08:00
2019-12-13 17:26:54 +08:00
protected $defaultSoftDelete = 0;
2019-12-07 17:31:38 +08:00
protected $autoWriteTimestamp = true;
2020-12-27 12:33:30 +08:00
// 分页 Limit
2020-01-21 17:57:33 +08:00
public const LIMIT = 10;
2019-12-07 17:31:38 +08:00
// 开启
public const ENABLE = 1;
// 禁用
public const DISABLE = 2;
2020-11-23 19:57:49 +08:00
/**
* 是否有 field
*
* @time 2020年11月23日
* @param string $field
* @return bool
*/
public function hasField(string $field)
{
2021-04-20 08:45:08 +08:00
return property_exists($this, 'field') && in_array($field, $this->field);
2020-11-23 19:57:49 +08:00
}
2019-12-06 09:17:40 +08:00
}