Update user registration email format, remove unused SMS helper function, and adjust database migration for user meta column
This commit is contained in:
36
app/Modules/SMS/Repositories/SMSRepository.php
Normal file
36
app/Modules/SMS/Repositories/SMSRepository.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\SMS\Repositories;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SMSRepository
|
||||
{
|
||||
/**
|
||||
* Send a sms
|
||||
*/
|
||||
public static function sendSMS(string|int $phone, string|int $message): mixed
|
||||
{
|
||||
$response = Http::retry(
|
||||
times: 3,
|
||||
sleepMilliseconds: 50,
|
||||
throw: false,
|
||||
when: function (Exception $exception, PendingRequest $request) {
|
||||
Log::error('Exception: ', [
|
||||
'message' => $exception->getMessage(),
|
||||
'line' => $exception->getLine(),
|
||||
]);
|
||||
|
||||
return true;
|
||||
})
|
||||
->post('http://216.250.14.144:3000/api/data', [
|
||||
'phone' => '+993'.$phone,
|
||||
'code' => $message,
|
||||
]);
|
||||
|
||||
return $response->body();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user