invite_code = md5($item->id, false); $item->coding = date('y').str_pad((string) $item->id, 10, '0', STR_PAD_LEFT); $item->save(); } /** * 时间修改器:生日 * * @param $value * @return null|mixed */ public function setBirthdayAttr($value) { return empty($value) ? null : $value; } /** * 时间获取器:生日 * @param $value * @return string */ public function getBirthdayAttr($value) { return empty($value) ? '' : $value; } /** * 客户标签 * * @return BelongsToMany */ public function tags(): BelongsToMany { return $this->belongsToMany(AccountTag::class, 'account_tag_pivot', 'tag_id', 'account_id'); } }