feat: endpoint parent/school-info (data sekolah dinamis dari settings)
This commit is contained in:
@@ -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
|
public function logout(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$request->user()->currentAccessToken()->delete();
|
$request->user()->currentAccessToken()->delete();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Route::post('/parent/login', [ParentAuthController::class, 'login'])
|
|||||||
Route::middleware('auth:sanctum')->prefix('parent')->group(function () {
|
Route::middleware('auth:sanctum')->prefix('parent')->group(function () {
|
||||||
// Akun
|
// Akun
|
||||||
Route::get('/me', [ParentAuthController::class, 'me'])->name('api.parent.me');
|
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');
|
Route::post('/logout', [ParentAuthController::class, 'logout'])->name('api.parent.logout');
|
||||||
|
|
||||||
// Anak (wali)
|
// Anak (wali)
|
||||||
|
|||||||
Reference in New Issue
Block a user