Method |
Description |
|
__call ( $method, $args ) |
|
|
__callStatic ( $method, $params ) |
|
|
__construct ( array | object $data = [] ) |
架构函数 |
|
__get ( string $name ) : mixed |
获取器 获取数据对象的值 |
|
__isset ( string $name ) : boolean |
检测数据对象的值 |
|
__set ( string $name, mixed $value ) : void |
修改器 设置数据对象的值 |
|
__toString ( ) |
|
|
__unset ( string $name ) : void |
销毁数据对象的值 |
|
__wakeup ( ) |
解序列化后处理 |
|
all ( mixed $data = null, array | string $with = [], boolean $cache = false ) : static[] | false |
查找所有记录 |
|
allowField ( boolean | array $field ) |
设置允许写入的字段 |
|
append ( array $append = [] ) |
设置需要追加的输出属性 |
|
auto ( array $fields ) |
设置自动完成的字段( 规则通过修改器定义) |
|
belongsTo ( string $model, string $foreignKey = '', string $otherKey = '', array $alias = [], string $joinType = 'INNER' ) : Relation |
BELONGS TO 关联定义 |
|
belongsToMany ( string $model, string $table = '', string $foreignKey = '', string $localKey = '', array $alias = [] ) : Relation |
BELONGS TO MANY 关联定义 |
|
create ( array $data = [] ) |
写入数据 |
|
data ( mixed $data, mixed $value = null ) |
设置数据对象值 |
|
db ( boolean $baseQuery = true ) : Query |
获取当前模型的数据库查询对象 |
|
delete ( ) : integer |
删除当前的记录 |
|
destroy ( mixed $data ) : integer |
删除记录 |
|
eagerlyResult ( Model $result, string $relation ) : Model |
预载入关联查询 返回模型对象 |
|
eagerlyResultSet ( array $resultSet, string $relation ) : array |
预载入关联查询 返回数据集 |
|
event ( string $event, callable $callback, boolean $override = false ) : void |
注册回调方法 |
|
get ( mixed $data = null, array | string $with = [], boolean $cache = false ) : static |
查找单条记录 |
|
getAttr ( string $name ) : mixed |
获取器 获取数据对象的值 |
|
getData ( string $name = null ) : mixed |
获取对象原始数据 如果不存在指定字段返回false |
|
getError ( ) : string |
返回模型的错误信息 |
|
getPk ( string $name = '' ) : mixed |
获取模型对象的主键 |
|
has ( string $relation, string $operator = '>=', integer $count = 1, string $id = '*' ) : Model |
根据关联条件查询当前模型 |
|
hasMany ( string $model, string $foreignKey = '', string $localKey = '', array $alias = [] ) : Relation |
HAS MANY 关联定义 |
|
hasManyThrough ( string $model, string $through, string $foreignKey = '', string $throughKey = '', string $localKey = '', array $alias = [] ) : Relation |
HAS MANY 远程关联定义 |
|
hasOne ( string $model, string $foreignKey = '', string $localKey = '', array $alias = [], string $joinType = 'INNER' ) : Relation |
HAS ONE 关联定义 |
|
hasWhere ( string $relation, mixed $where = [] ) : Model |
根据关联条件查询当前模型 |
|
hidden ( array $hidden = [] ) |
设置需要隐藏的输出属性 |
|
isUpdate ( boolean $update = true, mixed $where = null ) |
是否为更新数据 |
|
jsonSerialize ( ) |
JsonSerializable |
|
offsetExists ( $name ) |
|
|
offsetGet ( $name ) |
|
|
offsetSet ( $name, $value ) |
ArrayAccess |
|
offsetUnset ( $name ) |
|
|
relationQuery ( string | array $relations ) |
查询当前模型的关联数据 |
|
save ( array $data = [], array $where = [], string $sequence = null ) : integer | false |
保存当前数据对象 |
|
saveAll ( array $dataSet, boolean $replace = true ) : array | false |
保存多个数据到当前数据对象 |
|
scope ( string | array | Closure $name ) : Model |
命名范围 |
|
setAttr ( string $name, mixed $value, array $data = [] ) |
修改器 设置数据对象值 |
|
toArray ( ) : array |
转换当前模型对象为数组 |
|
toJson ( integer $options = JSON_UNESCAPED_UNICODE ) : string |
转换当前模型对象为JSON字符串 |
|
update ( array $data = [], array $where = [] ) |
更新数据 |
|
useGlobalScope ( boolean $use ) : Model |
设置是否使用全局查询范围 |
|
validate ( array | string | boolean $rule = true, array $msg = [] ) |
设置字段验证 |
|
validateFailException ( boolean $fail = true ) |
设置验证失败后是否抛出异常 |
|
visible ( array $visible = [] ) |
设置需要输出的属性 |
|