mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-09-03 05:41:38 +08:00
Model类field方法更名为allowField,增加saveAll方法批量新增数据
改进一对一的关联新增
This commit is contained in:
@@ -411,13 +411,27 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存多个数据到当前数据对象
|
||||
* @access public
|
||||
* @param array $data 数据
|
||||
* @return integer
|
||||
*/
|
||||
public function saveAll($dataSet)
|
||||
{
|
||||
foreach ($dataSet as $data) {
|
||||
$result = $this->save($data);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置允许写入的字段
|
||||
* @access public
|
||||
* @param bool $update
|
||||
* @return $this
|
||||
*/
|
||||
public function field($field)
|
||||
public function allowField($field)
|
||||
{
|
||||
$this->field = $field;
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user