This commit is contained in:
2024-01-30 23:40:29 +05:00
parent b3d9545900
commit 33d3980a6b
5 changed files with 56 additions and 46 deletions

View File

@@ -1,8 +1,10 @@
<?php
use App\Models\System\Verification;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Request as GuzzleRequest;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
/**
@@ -34,13 +36,13 @@ function sendSMS(string|int $phone, string|int $message)
"Text": "'.$message.'"
}
}';
$request = new Request('POST', 'http://10.3.158.103:8080/kpsmsroute/online.request', $headers, $body);
$request = new GuzzleRequest('POST', 'http://10.3.158.103:8080/kpsmsroute/online.request', $headers, $body);
try {
$res = $client->sendAsync($request)->wait();
return $res->getBody();
} catch (\Exception $e) {
} catch (Exception $e) {
Log::error($e);
}
}
@@ -58,3 +60,23 @@ function sendSMSVerification(string|int $phone_number): ?Verification
return $verification;
}
/**
* Store auth events
*/
function storeAuthEvent(string $name, Request $request): void
{
Log::channel('auth_activity')
->info(sprintf(
'%s, APP_NAME: %s, REQUEST_TYPE: %s, SOURCE_IP: %s, SOURCE_PORT: %s, SOURCE_URL: %s, DESTINATION_IP: %s, DESTINATION_PORT: %s, DESTINATION_COUNTRY: %s',
$name,
config('app.name'),
$request->method(),
$request->ip(),
$_SERVER['REMOTE_PORT'],
$request->url(),
$request->host(),
$request->getPort(),
'tk',
));
}