Penambahan Docs API Verifikator Absen
This commit is contained in:
@@ -93,3 +93,5 @@ GOOGLE_DRIVE_FOLDER_ID=0AJQK-NMrB4b_Uk9PVA
|
||||
# 1 = Login biasa (NIP/Password + Google OAuth)
|
||||
# 2 = Login SSO Portal Untan (khusus domain *.untan.ac.id)
|
||||
LOGIN_MODE=2
|
||||
|
||||
DOCS_TOKEN=3863b2e41c487d57f6a14d8a068eb817f244374bed7a9e3d
|
||||
|
||||
@@ -93,3 +93,6 @@ GOOGLE_DRIVE_FOLDER_ID=
|
||||
# 1 = Login Biasa (NIP/Password + Google OAuth)
|
||||
# 2 = Login SSO Portal Untan (khusus domain *.untan.ac.id)
|
||||
LOGIN_MODE=2
|
||||
|
||||
# Token akses halaman dokumentasi API (/docs)
|
||||
DOCS_TOKEN=
|
||||
|
||||
@@ -22,9 +22,9 @@ class MengajarController extends Controller
|
||||
$exceptions = [196312201988101001, 196106051986022001];
|
||||
$start = Carbon::parse('2024-05-20 00:00:00');
|
||||
$end = Carbon::parse('2024-06-15 23:59:59');
|
||||
$user = Pegawai::select('id', 'nip', 'nama', 'jenis_pegawai')->where('nip', $request->nip)->orWhere('nip_siakad', $request->nip)->firstOrFail();
|
||||
$user = Pegawai::select('id', 'nip', 'nama', 'jenis_pegawai')->where('nip', $request->nip)->orWhere('nip_siakad', $request->nip)->first();
|
||||
|
||||
if (!in_array($user->nip, $exceptions)) {
|
||||
if (!in_array($user?->nip, $exceptions)) {
|
||||
if (!now()->isBetween($start, $end)) {
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
@@ -33,6 +33,7 @@ class MengajarController extends Controller
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
abort_if(!$user, 404, 'Pegawai tidak ditemukan');
|
||||
try {
|
||||
if ($user->jenis_pegawai === 'dosen') {
|
||||
$token = $request->bearerToken();
|
||||
|
||||
@@ -37,12 +37,14 @@ class PengajuanAbsenController extends Controller
|
||||
$bulan--;
|
||||
}
|
||||
|
||||
$pegawais = Honorer::with('unit:id,nama')
|
||||
->select('nip', 'nama', 'unit_id')
|
||||
->with(['absen' => function ($query) use ($periode, $bulan) {
|
||||
$filterAbsen = function ($query) use ($periode, $bulan) {
|
||||
$query->where('periode', $periode)
|
||||
->whereMonth('tanggal_mulai', $bulan);
|
||||
}])
|
||||
};
|
||||
|
||||
$honorers = Honorer::with('unit:id,nama')
|
||||
->select('nip', 'nama', 'unit_id')
|
||||
->with(['absen' => $filterAbsen])
|
||||
->get()
|
||||
->map(function ($pegawai) {
|
||||
$absen = $pegawai->absen;
|
||||
@@ -52,13 +54,30 @@ class PengajuanAbsenController extends Controller
|
||||
});
|
||||
|
||||
return $pegawai;
|
||||
})
|
||||
});
|
||||
|
||||
$tendiks = Tendik::select('nip', 'nama', 'unit_kerja_id', 'unit_kerja_nama')
|
||||
->whereHas('absen', $filterAbsen)
|
||||
->with(['absen' => $filterAbsen])
|
||||
->get()
|
||||
->map(function ($pegawai) {
|
||||
$absen = $pegawai->absen;
|
||||
$unit = ['id' => $pegawai->unit_kerja_id, 'nama' => $pegawai->unit_kerja_nama];
|
||||
unset($pegawai->absen, $pegawai->unit_kerja_id, $pegawai->unit_kerja_nama);
|
||||
$pegawai->unit = $unit;
|
||||
$pegawai->absen = $absen->countBy(function ($absen) {
|
||||
return $absen->status;
|
||||
});
|
||||
|
||||
return $pegawai;
|
||||
});
|
||||
|
||||
return $honorers
|
||||
->concat($tendiks)
|
||||
->filter(function ($pegawai) {
|
||||
return $pegawai->absen->count();
|
||||
})
|
||||
->flatten(1);
|
||||
|
||||
return $pegawais;
|
||||
->values();
|
||||
}
|
||||
|
||||
public function show(Request $request, string $nip)
|
||||
@@ -488,7 +507,7 @@ class PengajuanAbsenController extends Controller
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
'code' => 200,
|
||||
'status' => false,
|
||||
'message' => 'Pengajuan absen tidak ditemukan',
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Amankan halaman dokumentasi API (/docs) dengan token statis dari DOCS_TOKEN.
|
||||
*
|
||||
* Token diterima lewat header "Authorization: Bearer <token>", header "X-Docs-Token",
|
||||
* atau query "?token=<token>". Setelah valid lewat query, dibuat cookie (berisi hash token)
|
||||
* supaya request lanjutan dari halaman (mis. /docs/api.json) tetap lolos.
|
||||
*/
|
||||
class DocsToken
|
||||
{
|
||||
private const COOKIE = 'docs_access';
|
||||
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$expected = (string) config('scramble.docs_token');
|
||||
|
||||
if ($expected === '') {
|
||||
return $this->deny('DOCS_TOKEN belum dikonfigurasi.', 403);
|
||||
}
|
||||
|
||||
$provided = $request->bearerToken()
|
||||
?: $request->header('X-Docs-Token')
|
||||
?: $request->query('token');
|
||||
|
||||
if (is_string($provided) && $provided !== '' && hash_equals($expected, $provided)) {
|
||||
$response = $next($request);
|
||||
|
||||
return $response->withCookie(cookie(
|
||||
self::COOKIE, hash('sha256', $expected), 60 * 8, '/docs', null, $request->isSecure(), true, false, 'lax'
|
||||
));
|
||||
}
|
||||
|
||||
// Token yang dikirim tapi salah selalu ditolak, walau cookie lama masih valid.
|
||||
if (is_string($provided) && $provided !== '') {
|
||||
return $this->deny('Token dokumentasi tidak valid.', 401)
|
||||
->withCookie(cookie()->forget(self::COOKIE, '/docs'));
|
||||
}
|
||||
|
||||
$cookie = $request->cookies->get(self::COOKIE);
|
||||
|
||||
if (is_string($cookie) && hash_equals(hash('sha256', $expected), $cookie)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return $this->deny('Token dokumentasi tidak valid atau belum disertakan.', 401);
|
||||
}
|
||||
|
||||
private function deny(string $message, int $status): Response
|
||||
{
|
||||
return response()->view('errors.docs-unauthorized', ['message' => $message], $status);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Support\ApiDocsSummaries;
|
||||
use Dedoc\Scramble\Scramble;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -20,6 +25,22 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Scramble::configure()->expose(
|
||||
ui: fn (Router $router, $action) => $router->get('docs', $action)->name('scramble.docs.ui'),
|
||||
document: fn (Router $router, $action) => $router->get('docs/api.json', $action)->name('scramble.docs.document'),
|
||||
);
|
||||
|
||||
Scramble::afterOpenApiGenerated(new ApiDocsSummaries);
|
||||
|
||||
// Batasi endpoint yang tampil di /docs lewat config('scramble.visible_routes').
|
||||
$defaultRoutes = Scramble::configure()->routes();
|
||||
Scramble::routes(function (Route $route) use ($defaultRoutes) {
|
||||
$visible = config('scramble.visible_routes', []);
|
||||
|
||||
return $defaultRoutes($route)
|
||||
&& ($visible === [] || Str::is($visible, $route->uri()));
|
||||
});
|
||||
|
||||
Relation::morphMap([
|
||||
'App\Models\Syarat' => 'App\Models\DokSiremun\Syarat',
|
||||
'App\Models\Mengajar' => 'App\Models\DokSiremun\Mengajar',
|
||||
|
||||
@@ -98,9 +98,9 @@ class PoinService
|
||||
}
|
||||
|
||||
if ($periode === 383) {
|
||||
$rawQuery = '(poin_total / sks) as poin_per_sks';
|
||||
$rawQuery = '(poin_total / CASE WHEN sks = 0 THEN 1 ELSE sks END) as poin_per_sks';
|
||||
} else {
|
||||
$rawQuery = '(poin_total / beban_mengajar) as poin_per_sks';
|
||||
$rawQuery = '(poin_total / CASE WHEN beban_mengajar = 0 THEN 1 ELSE beban_mengajar END) as poin_per_sks';
|
||||
}
|
||||
$mengajars = $this->triDharmaService->mengajarSiakad($nip, $periode, 6, 8, $column, $rawQuery, $jenjang, $tipeMk)->sortByDesc('poin_per_sks');
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Dedoc\Scramble\Support\Generator\OpenApi;
|
||||
|
||||
/**
|
||||
* Nama endpoint yang tampil di halaman /docs (sidebar & judul operasi).
|
||||
*
|
||||
* Kunci: "<method> <path>" sesuai route. Endpoint yang docblock-nya sudah punya
|
||||
* summary tidak ditimpa; tambahkan endpoint baru di sini agar punya nama yang rapi.
|
||||
*/
|
||||
class ApiDocsSummaries
|
||||
{
|
||||
private const SUMMARIES = [
|
||||
'get /v1/rubrik' => 'Daftar Rubrik',
|
||||
'get /v1/rubrik/{id}' => 'Detail Rubrik',
|
||||
|
||||
'get /v1/jabatan/{nip}' => 'Jabatan Pegawai',
|
||||
'get /v1/jabatan/fungsional' => 'Daftar Jabatan Fungsional',
|
||||
'get /v1/jabatan/tugas-tambahan' => 'Daftar Jabatan Tugas Tambahan',
|
||||
|
||||
'get /v1/pengajuan-absen' => 'Daftar Pengajuan Absen',
|
||||
'get /v1/pengajuan-absen/{nip}' => 'Pengajuan Absen Pegawai',
|
||||
'post /v1/pengajuan-absen' => 'Buat Pengajuan Absen',
|
||||
'post /v1/pengajuan-absen/exists' => 'Duplikasi Pengajuan Absen',
|
||||
'delete /v1/pengajuan-absen/delete/{id}' => 'Hapus Pengajuan Absen',
|
||||
'patch /v1/pengajuan-absen/batalkan/{id}' => 'Batalkan Pengajuan Absen',
|
||||
|
||||
'get /v1/poin/{nip}' => 'Poin Pegawai',
|
||||
|
||||
'get /v1/pegawai' => 'Daftar Pegawai',
|
||||
'get /v1/pegawai/{nip}' => 'Detail Pegawai',
|
||||
|
||||
'get /v1/laporan-kegiatan/kompetisi' => 'Laporan Kegiatan Kompetisi',
|
||||
'get /v1/laporan-kegiatan/mbkm' => 'Laporan Kegiatan MBKM',
|
||||
|
||||
'get /v1/pengajuan/sanggahan/{nip}' => 'Daftar Sanggahan',
|
||||
'post /v1/pengajuan/sanggahan' => 'Kirim Sanggahan',
|
||||
'get /v1/pengajuan/tri-dharma/mengajar' => 'Pengajuan Mengajar',
|
||||
'get /v1/pengajuan/tri-dharma/menguji' => 'Pengajuan Menguji',
|
||||
'get /v1/pengajuan/tri-dharma/membimbing' => 'Pengajuan Membimbing',
|
||||
'get /v1/pengajuan/mbkm' => 'Pengajuan MBKM',
|
||||
'get /v1/pengajuan/modul' => 'Pengajuan Modul',
|
||||
|
||||
'get /v1/verifikator/presensi/honorer/{unit}' => 'Presensi Honorer per Unit',
|
||||
'get /v1/verifikator/presensi/{unit}' => 'Presensi per Unit',
|
||||
'get /v1/verifikator/presensi/{unit}/{nip}' => 'Detail Presensi Pegawai',
|
||||
'get /v1/verifikator/presensi/{nip}/{nip}' => 'Detail Presensi Pegawai',
|
||||
|
||||
'get /v1/remunerasi/{nip}' => 'Remunerasi Pegawai',
|
||||
'get /v1/remunerasi/poin' => 'Poin Remunerasi',
|
||||
'get /v1/remunerasi/skp' => 'Data SKP',
|
||||
|
||||
'post /v1/verifikasi-absen/link' => 'Buat Link Verifikasi',
|
||||
'get /v1/verifikasi-absen/{id}' => 'Detail Verifikasi Absen',
|
||||
'post /v1/verifikasi-absen/{id}/setujui' => 'Setujui Pengajuan Absen',
|
||||
'post /v1/verifikasi-absen/{id}/tolak' => 'Tolak Pengajuan Absen',
|
||||
];
|
||||
|
||||
public function __invoke(OpenApi $openApi): void
|
||||
{
|
||||
foreach ($openApi->paths as $path) {
|
||||
foreach ($path->operations as $operation) {
|
||||
$key = strtolower($operation->method).' /'.ltrim($path->path, '/');
|
||||
|
||||
if ($operation->summary === '' && isset(self::SUMMARIES[$key])) {
|
||||
$operation->summary(self::SUMMARIES[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"dedoc/scramble": "^0.13.45",
|
||||
"google/apiclient": "^2.19",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/socialite": "^5.23",
|
||||
|
||||
Generated
+250
-61
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ff4de989ae1021516a8c7e527a1faed3",
|
||||
"content-hash": "10d90e96a4aad7de117b9533d45d6150",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -291,6 +291,87 @@
|
||||
],
|
||||
"time": "2025-08-20T19:15:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dedoc/scramble",
|
||||
"version": "v0.13.45",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dedoc/scramble.git",
|
||||
"reference": "4f096c49d555c580d7ce7a978896bb3d8b28dc4d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dedoc/scramble/zipball/4f096c49d555c580d7ce7a978896bb3d8b28dc4d",
|
||||
"reference": "4f096c49d555c580d7ce7a978896bb3d8b28dc4d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^10.0|^11.0|^12.0|^13.0",
|
||||
"myclabs/deep-copy": "^1.12",
|
||||
"nikic/php-parser": "^5.0",
|
||||
"php": "^8.1",
|
||||
"phpstan/phpdoc-parser": "^1.0|^2.0",
|
||||
"spatie/laravel-package-tools": "^1.9.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^3.3",
|
||||
"laravel/pint": "^v1.1.0",
|
||||
"laravel/scout": "^10.0|^11.0",
|
||||
"nunomaduro/collision": "^7.0|^8.0",
|
||||
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
|
||||
"pestphp/pest": "^2.34|^3.7|^4.4",
|
||||
"pestphp/pest-plugin-laravel": "^2.3|^3.1|^4.1",
|
||||
"phpstan/extension-installer": "^1.4",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^10.5|^11.5.3|^12.5.12",
|
||||
"spatie/laravel-permission": "^6.10|^7.2",
|
||||
"spatie/pest-plugin-snapshots": "^2.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Dedoc\\Scramble\\ScrambleServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dedoc\\Scramble\\": "src",
|
||||
"Dedoc\\Scramble\\Database\\Factories\\": "database/factories"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roman Lytvynenko",
|
||||
"email": "litvinenko95@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Automatic generation of API documentation for Laravel applications.",
|
||||
"homepage": "https://github.com/dedoc/scramble",
|
||||
"keywords": [
|
||||
"documentation",
|
||||
"laravel",
|
||||
"openapi"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/dedoc/scramble/issues",
|
||||
"source": "https://github.com/dedoc/scramble/tree/v0.13.45"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/romalytvynenko",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-09-18T15:47:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dflydev/dot-access-data",
|
||||
"version": "v3.0.3",
|
||||
@@ -3221,6 +3302,66 @@
|
||||
],
|
||||
"time": "2026-01-02T08:56:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.13.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.6.8",
|
||||
"doctrine/common": "^2.13.3 || ^3.2.2",
|
||||
"phpspec/prophecy": "^1.10",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-08-01T08:46:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.11.4",
|
||||
@@ -4041,6 +4182,53 @@
|
||||
],
|
||||
"time": "2026-04-10T01:33:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "2.3.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "1427af4647235b4a73b13940b1f1258d3584f36e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1427af4647235b4a73b13940b1f1258d3584f36e",
|
||||
"reference": "1427af4647235b4a73b13940b1f1258d3584f36e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "^2.0",
|
||||
"nikic/php-parser": "^5.3.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpstan/phpstan-strict-rules": "^2.0",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.6"
|
||||
},
|
||||
"time": "2026-09-27T20:07:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
"version": "3.0.0",
|
||||
@@ -4779,6 +4967,67 @@
|
||||
},
|
||||
"time": "2025-12-14T04:43:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-package-tools",
|
||||
"version": "1.93.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-package-tools.git",
|
||||
"reference": "7aeef26bd8d4909bec744dbf47aee7d1395588c1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/7aeef26bd8d4909bec744dbf47aee7d1395588c1",
|
||||
"reference": "7aeef26bd8d4909bec744dbf47aee7d1395588c1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^10.0|^11.0|^12.0|^13.0",
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.5",
|
||||
"orchestra/testbench": "^8.0|^9.2|^10.0|^11.0",
|
||||
"pestphp/pest": "^2.1|^3.1|^4.0",
|
||||
"phpunit/php-code-coverage": "^10.0|^11.0|^12.0",
|
||||
"phpunit/phpunit": "^10.5|^11.5|^12.5",
|
||||
"spatie/pest-plugin-test-time": "^2.2|^3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\LaravelPackageTools\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Tools for creating Laravel packages",
|
||||
"homepage": "https://github.com/spatie/laravel-package-tools",
|
||||
"keywords": [
|
||||
"laravel-package-tools",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-package-tools/issues",
|
||||
"source": "https://github.com/spatie/laravel-package-tools/tree/1.93.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-09-28T07:16:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-permission",
|
||||
"version": "6.25.0",
|
||||
@@ -8338,66 +8587,6 @@
|
||||
},
|
||||
"time": "2024-05-16T03:13:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.13.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.6.8",
|
||||
"doctrine/common": "^2.13.3 || ^3.2.2",
|
||||
"phpspec/prophecy": "^1.10",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-08-01T08:46:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nunomaduro/collision",
|
||||
"version": "v8.9.4",
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Middleware\DocsToken;
|
||||
|
||||
return [
|
||||
/*
|
||||
* Which routes to document. String or array form; use Scramble::routes() for custom selection.
|
||||
*
|
||||
* 'api_path' => [
|
||||
* 'include' => 'api',
|
||||
* 'exclude' => ['api/internal'],
|
||||
* ],
|
||||
*
|
||||
* Without *, patterns match path segments (api matches api and api/users, not apiary).
|
||||
* With *, Str::is is used (e.g. api/v*).
|
||||
*
|
||||
* One static include → default server is /{include} and paths are stripped (/users).
|
||||
* Multiple includes or wildcards → server defaults to / and paths stay full (/api/users).
|
||||
* Override with `servers`, or use Scramble::registerApi() for separate bases.
|
||||
*/
|
||||
'api_path' => 'api',
|
||||
|
||||
/*
|
||||
* Your API domain. By default, app domain is used. This is also a part of the default API routes
|
||||
* matcher, so when implementing your own, make sure you use this config if needed.
|
||||
*/
|
||||
'api_domain' => null,
|
||||
|
||||
/*
|
||||
* The path where your OpenAPI specification will be exported.
|
||||
*/
|
||||
'export_path' => 'api.json',
|
||||
|
||||
/*
|
||||
* Cache configuration for the generated OpenAPI document.
|
||||
*
|
||||
* Use `scramble:cache` to warm the cache and `scramble:clear` to invalidate it.
|
||||
*/
|
||||
'cache' => [
|
||||
'key' => 'scramble.openapi',
|
||||
'store' => 'file',
|
||||
],
|
||||
|
||||
'info' => [
|
||||
/*
|
||||
* API version.
|
||||
*/
|
||||
'version' => env('API_VERSION', '0.0.1'),
|
||||
|
||||
/*
|
||||
* Description rendered on the home page of the API documentation (`/docs/api`).
|
||||
*/
|
||||
'description' => 'Dokumentasi API Verifikator UNTAN.',
|
||||
],
|
||||
|
||||
'ui' => [
|
||||
'title' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
* Load Scramble's development tools on documentation pages. An explicit
|
||||
* SCRAMBLE_DEV_TOOLS value takes precedence over APP_DEBUG.
|
||||
*/
|
||||
'dev_tools' => [
|
||||
'enabled' => env('SCRAMBLE_DEV_TOOLS', env('APP_DEBUG', false)),
|
||||
],
|
||||
|
||||
'renderer' => 'elements',
|
||||
|
||||
'renderers' => [
|
||||
/*
|
||||
* Stoplight Elements config options: https://docs.stoplight.io/docs/elements/b074dc47b2826-elements-configuration-options
|
||||
*/
|
||||
'elements' => [
|
||||
'view' => 'scramble::docs',
|
||||
'theme' => 'light',
|
||||
'hideTryIt' => false,
|
||||
'hideSchemas' => true,
|
||||
'logo' => '',
|
||||
'tryItCredentialsPolicy' => 'include',
|
||||
'layout' => 'responsive',
|
||||
'router' => 'hash',
|
||||
],
|
||||
/*
|
||||
* Scalar API reference config options: https://scalar.com/products/api-references/configuration
|
||||
*/
|
||||
'scalar' => [
|
||||
'view' => 'scramble::scalar',
|
||||
'cdn' => 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
|
||||
'theme' => 'laravel',
|
||||
'proxyUrl' => 'https://proxy.scalar.com',
|
||||
'darkMode' => false,
|
||||
'showDeveloperTools' => 'never',
|
||||
'agent' => ['disabled' => true],
|
||||
'credentials' => 'include',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The list of servers of the API. By default, when `null`, server URL will be created from
|
||||
* `scramble.api_path` and `scramble.api_domain` config variables. When providing an array, you
|
||||
* will need to specify the local server URL manually (if needed).
|
||||
*
|
||||
* Example of non-default config (final URLs are generated using Laravel `url` helper):
|
||||
*
|
||||
* ```php
|
||||
* 'servers' => [
|
||||
* 'Live' => 'api',
|
||||
* 'Prod' => 'https://scramble.dedoc.co/api',
|
||||
* ],
|
||||
* ```
|
||||
*/
|
||||
'servers' => null,
|
||||
|
||||
/**
|
||||
* Determines how Scramble stores the descriptions of enum cases.
|
||||
* Available options:
|
||||
* - 'description' – Case descriptions are stored as the enum schema's description using table formatting.
|
||||
* - 'extension' – Case descriptions are stored in the `x-enumDescriptions` enum schema extension.
|
||||
*
|
||||
* @see https://redocly.com/docs-legacy/api-reference-docs/specification-extensions/x-enum-descriptions
|
||||
* - false - Case descriptions are ignored.
|
||||
*/
|
||||
'enum_cases_description_strategy' => 'description',
|
||||
|
||||
/**
|
||||
* Determines how Scramble stores the names of enum cases.
|
||||
* Available options:
|
||||
* - 'names' – Case names are stored in the `x-enumNames` enum schema extension.
|
||||
* - 'varnames' - Case names are stored in the `x-enum-varnames` enum schema extension.
|
||||
* - false - Case names are not stored.
|
||||
*/
|
||||
'enum_cases_names_strategy' => false,
|
||||
|
||||
/**
|
||||
* When Scramble encounters deep objects in query parameters, it flattens the parameters so the generated
|
||||
* OpenAPI document correctly describes the API. Flattening deep query parameters is relevant until
|
||||
* OpenAPI 3.2 is released and query string structure can be described properly.
|
||||
*
|
||||
* For example, this nested validation rule describes the object with `bar` property:
|
||||
* `['foo.bar' => ['required', 'int']]`.
|
||||
*
|
||||
* When `flatten_deep_query_parameters` is `true`, Scramble will document the parameter like so:
|
||||
* `{"name":"foo[bar]", "schema":{"type":"int"}, "required":true}`.
|
||||
*
|
||||
* When `flatten_deep_query_parameters` is `false`, Scramble will document the parameter like so:
|
||||
* `{"name":"foo", "schema": {"type":"object", "properties":{"bar":{"type": "int"}}, "required": ["bar"]}, "required":true}`.
|
||||
*/
|
||||
'flatten_deep_query_parameters' => true,
|
||||
|
||||
// Token akses halaman /docs diambil dari DOCS_TOKEN (lihat App\Http\Middleware\DocsToken).
|
||||
'docs_token' => env('DOCS_TOKEN'),
|
||||
|
||||
/*
|
||||
* Endpoint yang ditampilkan di /docs, berupa pola URI route (mendukung wildcard `*`).
|
||||
* Kosongkan ([]) untuk menampilkan semua endpoint. Contoh:
|
||||
* 'visible_routes' => [],
|
||||
*/
|
||||
'visible_routes' => ['api/v1/pengajuan-absen*'],
|
||||
|
||||
'middleware' => [
|
||||
DocsToken::class,
|
||||
],
|
||||
|
||||
'extensions' => [],
|
||||
|
||||
/*
|
||||
* Automatically document API security (OpenAPI `security` / `securitySchemes`) based on route
|
||||
* middleware.
|
||||
*
|
||||
* Disabled by default. Uncomment the line below to enable `MiddlewareAuthSecurityStrategy`.
|
||||
* When at least one documented route uses middleware matching the configured patterns (by default
|
||||
* `auth` and `auth:*`), bearer auth is applied globally. Routes without matching middleware are
|
||||
* marked as public (`security: []`).
|
||||
*
|
||||
* Set to `null` explicitly to disable. If you already configure security manually via
|
||||
* `afterOpenApiGenerated` / `extendOpenApi`, keep this disabled to avoid duplicate schemes.
|
||||
*
|
||||
* Customize with a class-string or [class, options]:
|
||||
*
|
||||
* 'security_strategy' => [
|
||||
* \Dedoc\Scramble\SecurityDocumentation\MiddlewareAuthSecurityStrategy::class,
|
||||
* [
|
||||
* 'middleware' => ['auth', 'auth:*'],
|
||||
* 'scheme' => \Dedoc\Scramble\Support\Generator\SecurityScheme::http('bearer'),
|
||||
* ],
|
||||
* ],
|
||||
*/
|
||||
// 'security_strategy' => \Dedoc\Scramble\SecurityDocumentation\MiddlewareAuthSecurityStrategy::class,
|
||||
'security_strategy' => null,
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Akses Ditolak | {{ config('app.name') }}</title>
|
||||
<link rel="shortcut icon" href="{{ asset('assets/images/logo-untan.png') }}">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #fafbfe; font-family: "Inter", sans-serif; color: #000; }
|
||||
.box { max-width: 420px; padding: 40px 32px; text-align: center; background: #fff; border: 1px solid #e3e6ec; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
|
||||
img { height: 56px; }
|
||||
h1 { font-size: 20px; margin: 16px 0 8px; }
|
||||
p { margin: 0; font-size: 14px; color: #6c757d; line-height: 1.6; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<img src="{{ asset('assets/images/logo-untan.png') }}" alt="UNTAN">
|
||||
<h1>Akses Ditolak</h1>
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-theme="{{ $config->renderer()->get('theme', 'light') }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="color-scheme" content="{{ $config->renderer()->get('theme', 'light') }}">
|
||||
<title>{{ $config->get('ui.title') ?? config('app.name') . ' - API Docs' }}</title>
|
||||
|
||||
<script src="https://unpkg.com/@stoplight/elements@8.4.2/web-components.min.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements@8.4.2/styles.min.css">
|
||||
<link rel="shortcut icon" href="{{ asset('assets/images/logo-untan.png') }}">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
||||
|
||||
@include('scramble::dev-tools', ['renderer' => 'elements'])
|
||||
|
||||
<script>
|
||||
const originalFetch = window.fetch;
|
||||
|
||||
// intercept TryIt requests and add the XSRF-TOKEN header,
|
||||
// which is necessary for Sanctum cookie-based authentication to work correctly
|
||||
window.fetch = (url, options) => {
|
||||
const CSRF_TOKEN_COOKIE_KEY = "XSRF-TOKEN";
|
||||
const CSRF_TOKEN_HEADER_KEY = "X-XSRF-TOKEN";
|
||||
const getCookieValue = (key) => {
|
||||
const cookie = document.cookie.split(';').find((cookie) => cookie.trim().startsWith(key));
|
||||
return cookie?.split("=")[1];
|
||||
};
|
||||
|
||||
const updateFetchHeaders = (
|
||||
headers,
|
||||
headerKey,
|
||||
headerValue,
|
||||
) => {
|
||||
if (headers instanceof Headers) {
|
||||
headers.set(headerKey, headerValue);
|
||||
} else if (Array.isArray(headers)) {
|
||||
headers.push([headerKey, headerValue]);
|
||||
} else if (headers) {
|
||||
headers[headerKey] = headerValue;
|
||||
}
|
||||
};
|
||||
const csrfToken = getCookieValue(CSRF_TOKEN_COOKIE_KEY);
|
||||
if (csrfToken) {
|
||||
const { headers = new Headers() } = options || {};
|
||||
updateFetchHeaders(headers, CSRF_TOKEN_HEADER_KEY, decodeURIComponent(csrfToken));
|
||||
return originalFetch(url, {
|
||||
...options,
|
||||
headers,
|
||||
});
|
||||
}
|
||||
|
||||
return originalFetch(url, options);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
:root { --verif-primary: #0166d2; --verif-bg: #fafbfe; --verif-topbar: 70px; }
|
||||
html, body { margin:0; height:100%; font-family: "Inter", sans-serif; }
|
||||
elements-api { display: block; height: 100%; }
|
||||
elements-api, elements-api * { font-family: "Inter", sans-serif; }
|
||||
elements-api { --color-primary: var(--verif-primary); --color-primary-light: #3d8ce0; --color-primary-dark: #014f9f; --color-primary-darker: #013a75; }
|
||||
.verif-topbar { height: var(--verif-topbar); box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 0 24px; background: #fff; border-bottom: 1px solid #e3e6ec; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
|
||||
.verif-topbar img { height: 36px; }
|
||||
.verif-topbar span { font-size: 20px; font-weight: 600; color: #000; }
|
||||
.verif-topbar small { font-size: 13px; color: #6c757d; margin-left: 6px; }
|
||||
.verif-content { height: calc(100vh - var(--verif-topbar)); overflow-y: auto; }
|
||||
body { background-color: var(--verif-bg); }
|
||||
/* Layout mengikuti aplikasi Verifikator: sidebar kiri + topbar */
|
||||
:root { --verif-side: 260px; }
|
||||
.verif-side { position: fixed; top: 0; bottom: 0; left: 0; width: var(--verif-side); background: #fff; border-right: 1px solid #e3e6ec; display: flex; flex-direction: column; z-index: 10; }
|
||||
.verif-logo { height: var(--verif-topbar); display: flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; text-decoration: none; }
|
||||
.verif-logo img { height: 36px; margin-bottom: 5px; }
|
||||
.verif-logo span { font-size: 20px; color: #000; }
|
||||
.verif-nav { flex: 1; overflow-y: auto; padding: 0 0 24px; }
|
||||
.verif-nav-title { padding: 12px 20px 6px; font-size: 12px; letter-spacing: .05rem; text-transform: uppercase; font-weight: 700; color: #000; }
|
||||
.verif-nav a { display: flex; align-items: center; gap: 8px; margin: 2px 8px; padding: 8px 12px; border-radius: 8px; font-size: 14px; color: #000; text-decoration: none; }
|
||||
.verif-nav a:hover { color: var(--verif-primary); }
|
||||
.verif-nav a.active { background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%); color: #fff; }
|
||||
.verif-nav a .m { flex-shrink: 0; min-width: 34px; text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 1px 4px; background: #e8f1fb; color: var(--verif-primary); }
|
||||
.verif-nav a.active .m { background: rgba(255,255,255,.2); color: #fff; }
|
||||
.verif-nav a .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* Warna metode HTTP */
|
||||
.verif-nav a .m { --mc: #0166d2; background: color-mix(in srgb, var(--mc) 14%, #fff); color: var(--mc); }
|
||||
.verif-nav a .m-get { --mc: #0acf97; }
|
||||
.verif-nav a .m-post { --mc: #0166d2; }
|
||||
.verif-nav a .m-put { --mc: #e6a700; }
|
||||
.verif-nav a .m-patch { --mc: #fd7e14; }
|
||||
.verif-nav a .m-delete { --mc: #fa5c7c; }
|
||||
.verif-nav a.active .m { background: rgba(255,255,255,.22); color: #fff; }
|
||||
/* Scrollbar tipis seperti simplebar di aplikasi */
|
||||
* { scrollbar-width: thin; scrollbar-color: rgba(115, 124, 138, .45) transparent; }
|
||||
*::-webkit-scrollbar { width: 6px; height: 6px; }
|
||||
*::-webkit-scrollbar-track { background: transparent; }
|
||||
*::-webkit-scrollbar-thumb { background: rgba(115, 124, 138, .45); border-radius: 6px; }
|
||||
*::-webkit-scrollbar-thumb:hover { background: rgba(115, 124, 138, .7); }
|
||||
.verif-nav { padding-right: 2px; }
|
||||
.verif-main { margin-left: var(--verif-side); height: 100vh; display: flex; flex-direction: column; }
|
||||
/* Area konten: lebar penuh, rapi */
|
||||
.sl-elements-api > div.sl-overflow-y-auto { padding-left: 32px !important; padding-right: 32px !important; background: var(--verif-bg) !important; }
|
||||
.sl-elements-api > div.sl-overflow-y-auto > div { max-width: none !important; width: 100%; padding-top: 32px !important; padding-bottom: 48px !important; }
|
||||
[data-testid="two-column-right"] { width: 52% !important; margin-left: 40px !important; }
|
||||
[data-testid="two-column-right"] > * { border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
|
||||
[data-testid="two-column-left"] { min-width: 0; }
|
||||
.sl-elements-api h1 { font-size: 30px !important; font-weight: 600 !important; }
|
||||
.sl-elements-api h2 { font-size: 22px !important; font-weight: 600 !important; }
|
||||
.sl-elements-api h3 { font-size: 17px !important; font-weight: 600 !important; }
|
||||
/* Contoh respons/request: lebar penuh, tanpa terpotong */
|
||||
[data-testid="two-column-right"] pre, [data-testid="two-column-right"] code { font-size: 13px; }
|
||||
[data-testid="two-column-right"] .sl-code-viewer, [data-testid="two-column-right"] .sl-panel__content { max-height: none !important; }
|
||||
.verif-topbar { justify-content: flex-start; flex-shrink: 0; }
|
||||
.verif-content { flex: 1; min-height: 0; height: auto !important; }
|
||||
/* Sembunyikan sidebar bawaan Elements pada layar lebar (diganti sidebar di atas) */
|
||||
.sl-elements-api > div:first-child:has([style*="min-width: 300px"]) { display: none !important; }
|
||||
@media (max-width: 991px) {
|
||||
.verif-side { display: none; }
|
||||
.verif-main { margin-left: 0; }
|
||||
}
|
||||
/* issues about the dark theme of stoplight/mosaic-code-viewer using web component:
|
||||
* https://github.com/stoplightio/elements/issues/2188#issuecomment-1485461965
|
||||
*/
|
||||
[data-theme="dark"] .token.property {
|
||||
color: rgb(128, 203, 196) !important;
|
||||
}
|
||||
[data-theme="dark"] .token.operator {
|
||||
color: rgb(255, 123, 114) !important;
|
||||
}
|
||||
[data-theme="dark"] .token.number {
|
||||
color: rgb(247, 140, 108) !important;
|
||||
}
|
||||
[data-theme="dark"] .token.string {
|
||||
color: rgb(165, 214, 255) !important;
|
||||
}
|
||||
[data-theme="dark"] .token.boolean {
|
||||
color: rgb(121, 192, 255) !important;
|
||||
}
|
||||
[data-theme="dark"] .token.punctuation {
|
||||
color: #dbdbdb !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="height: 100vh; overflow-y: hidden">
|
||||
@php
|
||||
$verifMethods = ['get', 'post', 'put', 'patch', 'delete'];
|
||||
$verifGroups = [];
|
||||
foreach (($spec['paths'] ?? []) as $verifPath => $verifItem) {
|
||||
foreach ($verifItem as $verifMethod => $verifOp) {
|
||||
if (! in_array($verifMethod, $verifMethods, true) || empty($verifOp['operationId'])) {
|
||||
continue;
|
||||
}
|
||||
$verifGroups[$verifOp['tags'][0] ?? 'Lainnya'][] = [
|
||||
'id' => $verifOp['operationId'],
|
||||
'method' => $verifMethod,
|
||||
'label' => $verifOp['summary'] ?? $verifPath,
|
||||
'path' => $verifPath,
|
||||
];
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<aside class="verif-side">
|
||||
<a class="verif-logo" href="#/">
|
||||
<img src="{{ asset('assets/images/logo-untan.png') }}" alt="UNTAN">
|
||||
<span>{{ config('app.name') }}</span>
|
||||
</a>
|
||||
<nav class="verif-nav" id="verif-nav">
|
||||
<div class="verif-nav-title">Dashboard</div>
|
||||
<a href="#/" data-hash="#/"><span class="t">Overview</span></a>
|
||||
@foreach($verifGroups as $verifTag => $verifOps)
|
||||
<div class="verif-nav-title">{{ preg_replace('/(?<=[a-z])(?=[A-Z])/', ' ', $verifTag) }}</div>
|
||||
@foreach($verifOps as $verifOp)
|
||||
<a href="#/operations/{{ rawurlencode($verifOp['id']) }}" data-hash="#/operations/{{ rawurlencode($verifOp['id']) }}" title="{{ $verifOp['path'] }}">
|
||||
<span class="m m-{{ $verifOp['method'] }}">{{ $verifOp['method'] }}</span>
|
||||
<span class="t">{{ $verifOp['label'] }}</span>
|
||||
</a>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</nav>
|
||||
</aside>
|
||||
<div class="verif-main">
|
||||
<header class="verif-topbar">
|
||||
<span>API Documentation</span>
|
||||
</header>
|
||||
<div class="verif-content">
|
||||
<elements-api
|
||||
id="docs"
|
||||
@foreach($config->renderer()->all(except: ['theme']) as $key => $value)
|
||||
@continue(! $value)
|
||||
{{ $key }}="{{ $value === true ? 'true' : ($value === false ? 'false' : $value) }}"
|
||||
@endforeach
|
||||
/>
|
||||
<script>
|
||||
(async () => {
|
||||
const docs = document.getElementById('docs');
|
||||
docs.apiDescriptionDocument = @json($spec);
|
||||
})();
|
||||
|
||||
// Tandai item sidebar yang aktif sesuai hash (router Elements memakai hash).
|
||||
(() => {
|
||||
const links = document.querySelectorAll('#verif-nav a');
|
||||
const sync = () => {
|
||||
const hash = location.hash || '#/';
|
||||
links.forEach((a) => {
|
||||
const on = a.dataset.hash === hash;
|
||||
a.classList.toggle('active', on);
|
||||
if (on) a.scrollIntoView({ block: 'nearest' });
|
||||
});
|
||||
};
|
||||
addEventListener('hashchange', sync);
|
||||
sync();
|
||||
})();
|
||||
</script>
|
||||
|
||||
@if($config->renderer()->get('theme', 'light') === 'system')
|
||||
<script>
|
||||
var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
function updateTheme(e) {
|
||||
if (e.matches) {
|
||||
window.document.documentElement.setAttribute('data-theme', 'dark');
|
||||
window.document.getElementsByName('color-scheme')[0].setAttribute('content', 'dark');
|
||||
} else {
|
||||
window.document.documentElement.setAttribute('data-theme', 'light');
|
||||
window.document.getElementsByName('color-scheme')[0].setAttribute('content', 'light');
|
||||
}
|
||||
}
|
||||
|
||||
mediaQuery.addEventListener('change', updateTheme);
|
||||
updateTheme(mediaQuery);
|
||||
</script>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user