Files
backend/app/Console/Commands/SendContractSmsNotification.php

72 lines
2.0 KiB
PHP

<?php
namespace App\Console\Commands;
use SoapFault;
use SoapClient;
use App\Models\ContractSubItems;
use Illuminate\Console\Command;
use Carbon\Carbon;
class SendContractSmsNotification extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:sendcontractsmsnotification';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$contractSubItems = ContractSubItems::where('last_date_update', '<' , Carbon::now()->subMonths(2))->where('last_status_id', '<>', 3)->get();
foreach ($contractSubItems as $key => $value) {
$message = "سلام،\n پروژه راهداری با کد یکتای {$value->unique_code} با مسئولیت شما، به مدت بیشتر از یک ماه به روزرسانی نشده است. لطفا نسبت به روز رسانی دقیق پیشرفت پروژه در سامانه اقدام نمایید.\n rms.rmto.ir";
// self::sms_sender($value->operator_phone, $message);
}
}
public function sms_sender($mobile, $msg)
{
$client=new SoapClient("http://sms1000.ir/webservice/smspro.asmx?WSDL");
$result=$client->doSendSMS(
array(
'uUsername' => 'rmto',
'uPassword' => 'Rahdari89',
'uNumber' => '1000141',
'uCellphones' => $mobile,
'uMessage' => $msg,
'uFarsi' => true,
'uTopic' => false,
'uFlash' => false
)
);
$x = $result->doSendSMSResult;
return $x;
}
}