Files
2026-06-10 08:30:03 +00:00

33 lines
857 B
PHP
Executable File

<?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));
}
}
}