新增createdBy方法

This commit is contained in:
JaguarJack 2020-04-21 21:16:23 +08:00
parent 3d65d111ee
commit 49f948fdd1

View File

@ -11,12 +11,27 @@ trait BaseOptionsTrait
* @return bool * @return bool
*/ */
public function storeBy(array $data) public function storeBy(array $data)
{
if ($this->allowField($this->field)->save($data)) {
return $this->{$this->getPk()};
}
return false;
}
/**
* 用于循环插入
*
* @time 2020年04月21日
* @param array $data
* @return mixed
*/
public function createBy(array $data)
{ {
$model = parent::create($data, $this->field, true); $model = parent::create($data, $this->field, true);
return $model->{$this->getPk()}; return $model->{$this->getPk()};
} }
/**33 /**33
* *
* @time 2019年12月03日 * @time 2019年12月03日