Files
approagency/app/Jobs/SendOTPJob.php
T
2026-02-18 11:04:47 +03:30

33 lines
857 B
PHP

<?php
namespace App\Jobs;
use App\Services\KavenegarService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class SendOTPJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(
private string $mobile,
private string $token
) {}
public function handle(KavenegarService $service)
{
$response = $service->sendVerify($this->mobile, $this->token);
logger()->info('Kavenegar response', $response);
if (!isset($response['return']) || $response['return']['status'] != 200) {
logger()->error('Kavenegar failed', $response);
throw new \Exception(json_encode($response));
}
}
}