<?php
namespace App\Helpers;
use App\Models\ApiTools;
use Illuminate\Support\Facades\Http;
// RESWARA_KEY
class ReswaraApi {
public static function checkUjian($email) {
$key = env("RESWARA_KEY");
// $ApiToken = ApiTools::find(1);
// $key = $ApiToken->value;
$response = Http::withHeaders([
'Authorization' => 'Bearer '.$key,
'Accept' => 'application/json',
])->get('https://reswara.top/api/lrn/riwayat-ujian/'.$email);
return $response->json();
}
public static function DaftarReswaraTop($email, $fullname, $password) {
$key = env("RESWARA_KEY");
// $ApiToken = ApiTools::find(1);
// $key = $ApiToken->value;
$response = Http::withHeaders([
'Authorization' => 'Bearer '.$key,
'Accept' => 'application/json',
])->post('https://reswara.top/api/itc/add-user', [
"email" => $email,
"fullname" => $fullname,
"password" => $password,
]);
// Menangani respon
if ($response->successful()) {
// Jika berhasil
$data = $response->json(); // Mengambil data dari respon
return $data;
} else {
// Jika terjadi error
return $response->body(); // Menampilkan pesan error
}
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]