55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use App\Repositories\Eloquent\SmsRepository as Sms;
|
|
use Illuminate\Container\Container as App;
|
|
|
|
use App\Http\Response\ResponseJson;
|
|
class SendEasySms implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
use ResponseJson;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected $data;
|
|
protected $message;
|
|
protected $mobile;
|
|
protected $template;
|
|
public function __construct($array)
|
|
{
|
|
$this->message = $array['message'];
|
|
$this->mobile = $array['mobile'];
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
try {
|
|
$app = new App;
|
|
$sms = new Sms($app);
|
|
//\Log::info($this->mobile);
|
|
$result = $sms->sentMessage($this->mobile, $this->message);
|
|
//\Log::info(json_encode($result));
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
$this->getError($e);
|
|
return false;
|
|
}
|
|
|
|
}
|
|
}
|