Giant Update

This commit is contained in:
Wian Drs
2026-07-31 13:57:11 +07:00
parent f68d967c8b
commit b0d08211ec
112 changed files with 6674 additions and 3 deletions
@@ -0,0 +1,24 @@
<?php
namespace App\Console\Commands;
use App\Services\Billing\InvoiceService;
use Illuminate\Console\Command;
class ProcessBillingSchedules extends Command
{
protected $signature = 'billing:process-schedules';
protected $description = 'Membuat tagihan customer dan memperbarui status sesuai jadwal profile tagihan';
public function handle(InvoiceService $service): int
{
$result = $service->processSchedules();
$this->info(
"Scheduler tagihan selesai: {$result['created']} dibuat, {$result['updated']} status diperbarui.",
);
return self::SUCCESS;
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Console\Commands;
use App\Models\NotificationChannel;
use App\Models\NotificationWebhookLog;
use App\Models\UserNotification;
use Illuminate\Console\Command;
class PruneNotifications extends Command
{
protected $signature = 'notifications:prune';
protected $description = 'Menghapus notifikasi aplikasi dan log webhook yang melewati masa retensi';
public function handle(): int
{
$deleted = 0;
NotificationChannel::where('channel', 'system')->where('enabled', true)->chunkById(100, function ($channels) use (&$deleted) {
foreach ($channels as $channel) {
$days = max(7, (int) data_get($channel->settings, 'retention_days', 90));
$deleted += UserNotification::where('tenant_id', $channel->tenant_id)
->where('created_at', '<', now()->subDays($days))->delete();
}
});
NotificationWebhookLog::where('created_at', '<', now()->subDays(90))->delete();
$this->info("{$deleted} notifikasi lama dihapus.");
return self::SUCCESS;
}
}