mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进Model类的allowField方法支持传入逗号分隔字符串
This commit is contained in:
@@ -936,11 +936,14 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 设置允许写入的字段
|
||||
* @access public
|
||||
* @param bool|array $field 允许写入的字段 如果为true只允许写入数据表字段
|
||||
* @param mixed $field 允许写入的字段 如果为true只允许写入数据表字段
|
||||
* @return $this
|
||||
*/
|
||||
public function allowField($field)
|
||||
{
|
||||
if (is_string($field)) {
|
||||
$field = explode(',', $field);
|
||||
}
|
||||
$this->field = $field;
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user