diff --git a/modules/applications/Logic/Approve.php b/modules/applications/Logic/Approve.php index 8732677..9b14cac 100644 --- a/modules/applications/Logic/Approve.php +++ b/modules/applications/Logic/Approve.php @@ -5,12 +5,15 @@ namespace App\Modules\applications\Logic; use A7kz\Platform\Models\UniModel; use A7kz\Platform\Modules\Platform\Acl\Facades\Acl; use A7kz\Platform\Modules\Platform\Core\Services\Base\Logic; +use App\Http\Notifications\TelegramNotification; use App\Models\User; use App\Modules\applications\Enum\ApplicationStatus; use App\Modules\auto\Enums\AutoStatusEnums; use Carbon\CarbonPeriod; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\Notification; +use Illuminate\Support\Str; class Approve extends Logic { @@ -24,12 +27,13 @@ class Approve extends Logic $this->row->user_id = $checkUser->id; $this->row->save(); } else { + $password = Str::random(12); $user->forceFill([ 'name' => $this->row->user_name . ' ' . $this->row->surname_name, 'username' => $this->row->user_email, 'email' => $this->row->user_email, 'phone' => $this->row->user_phone, - 'password' => Hash::make('password'), + 'password' => Hash::make($password), ]); $user->save(); @@ -79,6 +83,12 @@ class Approve extends Logic 'user_id' => $user->id, 'default' => true, ]); + $text = [ + 'Сообщение' => __('Пользователь создан'), + 'Логин' => 'Логин: ' . $user->email, + 'Пароль' => 'Пароль: ' . $password + ]; + Notification::send([$text], new TelegramNotification($text)); } }