// Intercept mock requests
if ($mock) { return $this->
createMock($count);
} $ids =
[];
// Iterate over new entities and insert each one, storing insert IDs
foreach ($this->
make($count ?? 1
) as $result) { if ($id =
$this->model->
insert($result, true
)) { $ids[] =
$id;
self::
upCount($this->model->table
);
continue;
} throw FrameworkException::
forFabricatorCreateFailed($this->model->table,
implode(' ',
$this->model->
errors() ??
[]));
} // If the model defines a "withDeleted" method for handling soft deletes then use it
if (method_exists($this->model, 'withDeleted'
)) { $this->model->
withDeleted();
}