feat: endpoint parent/school-info (data sekolah dinamis dari settings)

This commit is contained in:
Novy San87
2026-08-05 21:05:27 +07:00
parent 6907ee2968
commit 1cb1cb0569
2 changed files with 21 additions and 0 deletions
@@ -150,6 +150,26 @@ class ParentAuthController extends Controller
]);
}
/**
* Informasi sekolah (dinamis dari pengaturan).
*/
public function schoolInfo(): JsonResponse
{
return response()->json([
'school' => [
'name' => \App\Models\Setting::getValue('school_name', 'SMKN 1 WONOREJO'),
'full_name' => \App\Models\Setting::getValue('school_full_name', ''),
'address' => \App\Models\Setting::getValue('school_address', ''),
'phone' => \App\Models\Setting::getValue('school_phone', ''),
'postal_code' => \App\Models\Setting::getValue('school_postal', ''),
'website_email' => \App\Models\Setting::getValue('school_website_email', ''),
'principal_name' => \App\Models\Setting::getValue('kepala_sekolah_name', ''),
'academic_year' => \App\Models\Student::where('is_active', true)->max('academic_year_name') ?? '',
'start_time' => '07:00',
],
]);
}
public function logout(Request $request): JsonResponse
{
$request->user()->currentAccessToken()->delete();
+1
View File
@@ -26,6 +26,7 @@ Route::post('/parent/login', [ParentAuthController::class, 'login'])
Route::middleware('auth:sanctum')->prefix('parent')->group(function () {
// Akun
Route::get('/me', [ParentAuthController::class, 'me'])->name('api.parent.me');
Route::get('/school-info', [ParentAuthController::class, 'schoolInfo'])->name('api.parent.school-info');
Route::post('/logout', [ParentAuthController::class, 'logout'])->name('api.parent.logout');
// Anak (wali)