Model类增加readonly方法

This commit is contained in:
thinkphp
2017-01-30 08:33:55 +08:00
parent 8a06e801c8
commit ba4c5d39b4

View File

@@ -1018,6 +1018,21 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
return $this;
}
/**
* 设置只读字段
* @access public
* @param mixed $field 只读字段
* @return $this
*/
public function readonly($field)
{
if (is_string($field)) {
$field = explode(',', $field);
}
$this->readonly = $field;
return $this;
}
/**
* 是否为更新数据
* @access public