Feat: backup restore#1086
Open
pandigresik wants to merge 5 commits into
Open
Conversation
|
🔄 AI PR Review sedang antri di server...
|
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: Fitur Backup & Restore Database dan Storage
Description
Menambahkan fitur backup dan restore database serta file asset (storage) pada halaman Pengaturan Aplikasi. Fitur ini memudahkan proses migrasi server atau instalasi ulang dengan tetap menjaga data lama dapat sepenuhnya dipindahkan ke aplikasi baru. Menggunakan package
spatie/laravel-backupuntuk proses backup, dan menyediakan mekanisme restore dari file backup yang tersimpan maupun upload file backup.Changes made:
app/Http/Controllers/BackupController.php): Controller untuk mengelola backup — index, run, download, delete, restore, dan upload+restore. Menggunakan traitUploadedFileuntuk upload file.app/Http/Requests/RestoreBackupRequest.php): Validasi upload file backup (required, file, mimes:zip, max 50MB).resources/views/backup/index.blade.php): Halaman manajemen backup dengan tabel daftar backup, tombol Backup Sekarang, Upload & Restore, serta aksi download/restore/hapus per file.routes/web.php): 6 route untuk backup (index,store,show,update,upload,destroy) di prefixpengaturan/backup.pengaturan-database-{read,write,edit,delete}) yang diberikan ke role administrator.composer.json): Menambahkanspatie/laravel-backup ^10.3.config/backup.php): Konfigurasi backup — sumber (database + storage/app), tujuan (diskbackups), notifikasi, dan strategi pembersihan.config/filesystems.php): Menambahkan diskbackupsdengan rootstorage/app/backups/{APP_NAME}.app/Enums/Modul.php): Menambahkan submenu "Database" di grup Pengaturan.app/Http/Middleware/EasyAuthorize.php): Menambahkan mapping'upload' => 'write'untuk permission.routes/breadcrumbs.php): Menambahkan breadcrumb untuk halaman backup.tests/Feature/BackupControllerTest.php): 11 test cases mencakup index, run, download, delete, dan edge cases.lang/vendor/backup/*/notifications.php): 24 file notifikasi dari Spatie Backup untuk berbagai bahasa, termasuk bahasa Indonesia.Reason for change:
Impact of change:
✅ Fitur baru: Admin dapat membuat, melihat, mengunduh, dan menghapus backup database + storage.
✅ Restore fleksibel: Bisa restore dari backup yang tersimpan di sistem, maupun upload file backup.zip untuk skenario pindah server.
✅ Keamanan: Validasi server-side (mimes:zip, max size), proteksi Zip Slip, file dipindah dari public path sebelum diproses.
✅ Pengaturan permission: 4 permission terintegrasi dengan sistem EasyAuthorize yang sudah ada.
Related Issue
Steps to Reproduce
Sebelum fitur:
Setelah fitur:
Checklist
Technical Details
Arsitektur Backup
spatie/laravel-backupviaphp artisan backup:runstorage/app/backups→storage/app/backups/{APP_NAME}/storage/app/Arsitektur Restore
DB::unprepared()→ copystorage/app/dari backupUploadedFile→ pindah ke temp non-public → ekstrak → restorePermission Mapping
backup.indexpengaturan-database-readbackup.storepengaturan-database-writebackup.showpengaturan-database-readbackup.updatepengaturan-database-editbackup.uploadpengaturan-database-writebackup.destroypengaturan-database-deleteConfiguration changes
config/filesystems.php: Menambahkan diskbackupsconfig/backup.php: File konfigurasi baru untuk Spatie BackupDependencies added
spatie/laravel-backup: ^10.3Testing
Manual Testing
Automated Testing
tests/Feature/BackupControllerTest.phpBreaking Changes
None. Fitur baru, tidak mengubah perilaku existing.
Migration Guide
Tidak diperlukan migrasi khusus. Jalankan
php artisan migrateuntuk menambahkan menu dan permission. Jalankancomposer installuntuk menginstall package baru.Video
simplescreenrecorder-2026-07-04_05.57.52.mp4