Update ModelCustomerCreatedListener.php

This commit is contained in:
Bozhidar Slaveykov 2024-04-04 15:42:33 +03:00
parent 7f1de122fe
commit f5cb5e8263

View file

@ -58,16 +58,13 @@ class ModelCustomerCreatedListener
$createLinuxWebUser->setPassword($password);
$createLinuxWebUserOutput = $createLinuxWebUser->handle();
dd($createLinuxWebUserOutput);
$findCustomer->username = $generateUsername . $findCustomer->id;
$findCustomer->save();
if (strpos($createLinuxWebUserOutput, 'Creating home directory') !== false) {
$findCustomer->username = $generateUsername . $findCustomer->id;
$findCustomer->save();
}
}
private static function _generateUsername($fullName)
{
$removedMultispace = preg_replace('/\s+/', ' ', $fullName);