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