big update all menus

This commit is contained in:
Wian Drs
2026-08-07 09:16:13 +07:00
parent 75342dc7b7
commit e7575ba1c0
101 changed files with 3451 additions and 89 deletions
@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands;
use App\Models\NasMikrotik;
use App\Jobs\CheckMikrotikConnection;
use Illuminate\Console\Command;
class CheckMikrotikConnections extends Command
{
protected $signature = 'nas:check-mikrotiks {--id=* : ID Mikrotik tertentu}';
protected $description = 'Mengantrekan pemeriksaan koneksi NAS yang sudah jatuh tempo';
public function handle(): int
{
$queued = 0;
NasMikrotik::query()
->where('status', 'active')
->where(fn ($query) => $query->whereNull('next_health_check_at')->orWhere('next_health_check_at', '<=', now()))
->when($this->option('id'), fn ($query) => $query->whereIn('id', $this->option('id')))
->select(['id'])
->chunkById(100, function ($devices) use (&$queued) {
foreach ($devices as $index => $device) {
CheckMikrotikConnection::dispatch($device->id)->delay(now()->addSeconds($index % 60));
$queued++;
}
});
$this->info("{$queued} pemeriksaan NAS masuk antrean nas-health.");
return self::SUCCESS;
}
}