新增createdBy方法
This commit is contained in:
parent
3d65d111ee
commit
49f948fdd1
@ -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日
|
||||||
|
Loading…
x
Reference in New Issue
Block a user