Jalankan php artisan migrate untuk menambahkan status DL dan kolom bukti pulang. Migrasi lama tidak diubah.
Endpoint berikut memerlukan token Sanctum (Authorization: Bearer <token>) dan menerima multipart/form-data:
| Aksi | Endpoint | Field wajib |
|---|---|---|
| Mulai DL | POST /api/v1/absen/dinas-luar/masuk |
photo_masuk, keterangan, ttd |
| Selesai DL | POST /api/v1/absen/dinas-luar/pulang |
photo_pulang, keterangan, ttd |
Kedua endpoint juga tersedia dengan prefix /api/v2/absen/dinas-luar. Foto harus berupa gambar maksimal 10 MB, keterangan maksimal 255 karakter, dan tanda tangan berupa string seperti pada presensi biasa. Koordinat tidak diperlukan; tidak ada batas radius maupun jam kerja.
- DL hanya dapat dimulai jika belum ada presensi apa pun pada tanggal tersebut.
- Pulang DL harus dilakukan pada tanggal server yang sama, oleh pengguna yang memulai DL, dan hanya sekali. Sesi DL tidak dapat ditutup melalui endpoint pulang biasa.
- Status tersimpan sebagai
dinas luar; respons presensi/riwayat menyediakanlabel_status: "Dinas Luar (DL)". Frontend dapat memakai field ini untuk menampilkan label. Ekspor detail juga menggunakan label tersebut. - DL masuk dalam
total_hadir, bukantotal_izin, termasuk ketika belum melakukan presensi pulang, mengikuti perhitungan presensi masuk biasa. - Foto, keterangan, dan tanda tangan masuk disimpan pada
photo_masuk,keterangan, danttd. Bukti pulang disimpan terpisah padaphoto_keluar,catatan_pulang, danttd_pulang, tanpa menimpa bukti masuk. - Respons sukses berisi
messagedandata. Validasi input menggunakan HTTP 422; konflik presensi atau sesi DL yang tidak tersedia menggunakan HTTP 403.
Rollback migrasi mengubah status DL menjadi hadir/normal dan menghapus kolom bukti tambahan pulang. Cadangkan data sebelum rollback jika bukti DL harus dipertahankan.
Pengujian fitur: php vendor/bin/phpunit tests/Feature/DinasLuarTest.php. Gunakan database MySQL khusus testing melalui konfigurasi environment; konfigurasi SQLite bawaan masih terhambat migrasi role lama yang menggunakan sintaks MySQL.
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Partners program.
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.