feat: add otp sms

This commit is contained in:
2026-02-18 11:04:47 +03:30
parent bbe70011dc
commit e98c0502db
4 changed files with 84 additions and 7 deletions
+32
View File
@@ -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));
}
}
}