feat: add otp sms
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user