Penambahan fitur Log Aktivitas - #1708
Merged
Merged
Conversation
Contributor
|
🔄 AI PR Review sedang antri di server...
|
pandigresik
force-pushed
the
fitur/001-log-aktivitas
branch
from
August 17, 2026 23:56
b855427 to
3bc47ed
Compare
This was referenced Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Feat: Tambah fitur Log Aktivitas
Description
Penambahan fitur pencatatan aktivitas (audit trail) menggunakan
spatie/laravel-activityloguntuk mencatat perubahan penting pada model aplikasi seperti Data Umum, Profil, Komplain, Setting Aplikasi, dan User. Fitur ini juga menyediakan halaman admin untuk melihat dan memfilter log aktivitas yang tercatat.Changes made:
app/Services/ActivityLogService.php— Service layer untuk logging aktivitas dengan pengecekan ketersediaan tabelactivity_logapp/Observers/DataUmumObserver.php— Observer untuk mencatat perubahan model DataUmumapp/Observers/KomplainObserver.php— Observer untuk mencatat perubahan model Komplainapp/Observers/ProfilObserver.php— Observer untuk mencatat perubahan model Profilapp/Observers/SettingAplikasiObserver.php— Observer untuk mencatat perubahan model SettingAplikasiapp/Observers/UserObserver.php— Menambahkan logging aktivitas pada event observer Userapp/Models/DataUmum.php,Komplain.php,Profil.php,SettingAplikasi.php,User.php— Mendaftarkan observer modelapp/Providers/AppServiceProvider.php— Menambahkan event listener untuk auto-log login, logout, dan failed loginapp/Http/Livewire/Pengaturan/LogAktivitasTable.php— Livewire component untuk menampilkan log aktivitas dengan filterapp/Http/Controllers/Setting/LogAktivitasController.php— Controller untuk menampilkan halaman log aktivitasresources/views/livewire/pengaturan/log-aktivitas-table.blade.php— Blade template untuk tabel log aktivitasresources/views/setting/log-aktivitas/index.blade.php— Blade template halaman log aktivitasdatabase/migrations/2026_08_14_104239_create_activity_log_table.php— Migrasi tabelactivity_logconfig/activitylog.php— Konfigurasi spatie/laravel-activitylogroutes/web.php— Menambahkan route untuk halaman log aktivitascomposer.json/composer.lock— Menambahkan dependencyspatie/laravel-activitylogdatabase/seeders/RoleSpatieSeeder.php— Menambahkan permission untuk akses log aktivitasresources/views/layouts/dashboard_template.blade.php— Menambahkan menu navigasi log aktivitastests/Feature/Audit/AuditTrailTest.php— Test fitur audit trailtests/Feature/Livewire/LogAktivitasTableTest.php— Test Livewire component log aktivitastests/Unit/Services/ActivityLogServiceTest.php— Test unit ActivityLogServiceReason for change:
Impact of change:
✅ Audit trail lengkap: Semua perubahan penting pada model penting tercatat dengan detail perubahan
✅ Keamanan: Login, logout, dan failed login tercatat untuk monitoring
✅ UI admin: Admin dapat melihat log aktivitas dengan filter tanggal, user, event, dan keyword
✅ Test coverage: Fitur dilengkapi unit test, feature test, dan Livewire test
✅ Tidak memutus migrasi: Pengecekan
Schema::hasTable()memastikan migrasi tidak error saat tabel belum adaRelated Issue
Steps to Reproduce
Before (problem):
After (solution):
activity_logChecklist
Technical Details
Technical Explanation
Fitur ini menggunakan package
spatie/laravel-activityloguntuk mencatat aktivitas. Setiap model yang diinginkan memiliki observer yang mendaftarkan perubahan viaActivityLogService. Event listener diAppServiceProvidermenangkap event login/logout/failed login secara otomatis.Komponen Livewire
LogAktivitasTablemenyediakan antarmuka filter dan tabel log dengan pagination. ServiceActivityLogServicemenangani pengecekan ketersediaan tabelactivity_logmenggunakan static flag +Schema::hasTable()agar tidak memicu error saat migrasi/testing.Configuration changes
config/activitylog.phpditambahkan untuk mengonfigurasi package activity logACTIVITYLOG_ENABLEDenvironment variable dapat digunakan untuk mengontrol apakah logging aktifDependencies added
spatie/laravel-activitylog: ^4.8Testing
Manual Testing
php artisan migratepada fresh database untuk pastikan tidak errorphp artisan testuntuk pastikan semua test lulusAutomated Testing
ActivityLogServiceTest(12 test cases)AuditTrailTest(10 test cases)LogAktivitasTableTest(5 test cases)Scrennshots
Breaking Changes
Tidak ada breaking changes. Package baru ditambahkan dan tabel baru dibuat melalui migrasi.
Migration Guide
Tidak diperlukan migrasi manual. Cukup jalankan
php artisan migrateuntuk membuat tabelactivity_log.References