maxSn
This commit is contained in:
parent
578ff82c3e
commit
163e3d2130
@ -14,7 +14,6 @@ class CommonService
|
||||
public static function stringifyCompanyId($companyId)
|
||||
{
|
||||
return sprintf('No%011d', $companyId);
|
||||
return intval(str_replace('No', '', $companyId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,10 @@ class CompanyService extends Service
|
||||
if (!$attributes['id']) {
|
||||
$maxId = Company::withTrashed()->max('id');
|
||||
$attributes['id'] = $maxId ? $maxId + 1 : 1;
|
||||
$attributes['sn'] = CommonService::stringifyCompanyId($attributes['id']);
|
||||
|
||||
$maxSn = Company::withTrashed()->max('sn');
|
||||
$maxSn = intval(str_replace('No', '', $maxSn));
|
||||
$attributes['sn'] = CommonService::stringifyCompanyId($maxSn);
|
||||
|
||||
$node = $this->companyRepository->create($attributes);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user