feat: menu & API Informasi Sekolah untuk aplikasi wali

- Tabel school_informations (judul, isi, kategori, tanggal kegiatan, publish)
- Menu admin 'Informasi Sekolah' (CRUD + permission manage-school-info)
- API wali: GET /parent/school-informations (hanya yang dipublikasikan)
- 2 data contoh: Jadwal UTS & Class Meet
- Test suite tetap hijau (39 test)
This commit is contained in:
Novy San87
2026-08-05 21:11:06 +07:00
parent 1cb1cb0569
commit 31643ff7dc
8 changed files with 376 additions and 0 deletions
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\SchoolInformation;
use Illuminate\Http\JsonResponse;
class ParentSchoolInformationController extends Controller
{
/**
* Daftar informasi sekolah yang dipublikasikan (untuk app wali murid).
*/
public function index(): JsonResponse
{
$items = SchoolInformation::query()
->where('is_published', true)
->orderByDesc('event_date')
->orderByDesc('created_at')
->limit(50)
->get()
->map(fn (SchoolInformation $i) => [
'id' => $i->id,
'title' => $i->title,
'content' => $i->content,
'category' => $i->category,
'event_date' => $i->event_date?->toDateString(),
'created_at' => $i->created_at?->toISOString(),
]);
return response()->json(['informations' => $items]);
}
}