eSchool Dev Docs

Struktur Project

Penjelasan folder dan file penting di codebase

Gambaran folder

eschool/
├── app/
│   ├── Http/
│   │   ├── Controllers/   # logika request
│   │   ├── Middleware/    # termasuk deteksi tenant
│   │   └── Requests/      # validasi form
│   ├── Models/            # model Eloquent
│   └── Services/          # logika bisnis
├── config/                # konfigurasi aplikasi
├── database/
│   ├── migrations/        # skema database
│   └── seeders/
├── resources/views/       # tampilan Blade
├── routes/
│   ├── web.php            # route web
│   └── api.php            # route API
└── tests/

Sesuaikan pohon folder di atas dengan struktur asli project, termasuk jika memakai pemisahan per modul.

Aturan penempatan kode

  • Controller tipis: terima request, panggil service, kembalikan response.
  • Service berisi logika bisnis yang bisa dipakai ulang.
  • Model berisi relasi, scope, dan accessor, bukan logika bisnis berat.
  • Request class untuk semua validasi input.

Menambah modul baru

Buat migration, model, dan controller:

php artisan make:model Contoh -mc

Daftarkan route di routes/web.php atau routes/api.php.

Tambahkan test di folder tests/.

Tulis dokumentasinya di folder content/docs repo dokumentasi ini.

On this page