master
Rustem 2025-06-14 22:16:22 +05:00
parent 56921dd6d4
commit db933f8aca
1 changed files with 11 additions and 1 deletions

View File

@ -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));
}
}