mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 21:11:05 +03:30
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Notification;
|
|
|
|
use App\Models\User;
|
|
|
|
class SendSmsToAdmins
|
|
{
|
|
protected array $mobiles;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->mobiles = [
|
|
"09101526570",
|
|
"09128529050"
|
|
];
|
|
}
|
|
|
|
public function sendRequestNotification($device_title, $smsUser)
|
|
{
|
|
$adminCollection = User::query()
|
|
->orWhere('role', 'admin');
|
|
|
|
$adminText = "کاربر %s
|
|
با شماره ی همراه %s
|
|
درخواستی زیر را ثبت کرد\n
|
|
%s\n";
|
|
$adminText = sprintf($adminText, $smsUser->full_name, $smsUser->cell_number, $device_title);
|
|
SmsNotification::to($adminCollection)->isSystematic()->send(
|
|
$adminText,
|
|
'service'
|
|
);
|
|
|
|
|
|
$userText = "%s عزیز\n
|
|
درخواست شما را دریافت کردیم\n
|
|
به زودی همکاران ما با شما تماس خواهند گرفت\n
|
|
از اعتماد شما سپاسگزاریم\n";
|
|
$userText = sprintf($userText, $smsUser->full_name);
|
|
$userCollection = User::query()->where('id', $smsUser->id);
|
|
$res = SmsNotification::to($userCollection)->isSystematic()->send(
|
|
$userText,
|
|
'service'
|
|
);
|
|
}
|
|
}
|