diff --git a/app/Providers/LpjServiceProvider.php b/app/Providers/LpjServiceProvider.php index a7f8df1..45c145b 100644 --- a/app/Providers/LpjServiceProvider.php +++ b/app/Providers/LpjServiceProvider.php @@ -32,25 +32,46 @@ } /** - * Register commands in the format of Command::class - */ - protected function registerCommands() - : void - { - // $this->commands([]); - } + * Register commands in the format of Command::class + */ + protected function registerCommands() + : void + { + $this->commands([ + \Modules\Lpj\Console\Commands\CleanupInspeksiDataCommand::class, + \Modules\Lpj\Console\Commands\CleanupSingleInspeksiCommand::class, + \Modules\Lpj\Console\Commands\CleanupInspeksiStatusCommand::class, + ]); + } /** - * Register command Schedules. - */ - protected function registerCommandSchedules() - : void - { - // $this->app->booted(function () { - // $schedule = $this->app->make(Schedule::class); - // $schedule->command('inspire')->hourly(); - // }); - } + * Register command Schedules. + */ + protected function registerCommandSchedules() + : void + { + $this->app->booted(function () { + $schedule = $this->app->make(\Illuminate\Console\Scheduling\Schedule::class); + + // Jalankan cleanup inspeksi setiap hari jam 2 pagi + $schedule->command('lpj:cleanup-inspeksi --force') + ->dailyAt('02:00') + ->withoutOverlapping() + ->onOneServer() + ->runInBackground() + ->appendOutputTo(storage_path('logs/cleanup-inspeksi.log')); + + // Backup cleanup setiap minggu + $schedule->command('lpj:cleanup-inspeksi --force') + ->weekly() + ->sundays() + ->at('03:00') + ->withoutOverlapping() + ->onOneServer() + ->runInBackground() + ->appendOutputTo(storage_path('logs/cleanup-inspeksi-weekly.log')); + }); + } /** * Register translations.