-
app/Console/Commands/GamePingCommand.php
Open in GitHubuse Azuriom\Models\Server; use Azuriom\Models\Setting; use Illuminate\Console\Command; class GamePingCommand extends Command { protected $signature = 'game:ping'; protected $description = 'Ping the game servers to update their stats.'; public function handle() { Setting::updateSettings('schedule.last', now()->toISOString()); $servers = Server::pingable()->get(); foreach ($servers as $server) { $data = $server->bridge()->getServerData(); $server->updateData($data, now()->minute % 15 === 0); } $this->info($servers->count().' server(s) were successfully pinged.'); } }
-
app/Console/Kernel.php
Open in GitHubclass Kernel extends ConsoleKernel { /** * Define the application's command schedule. */ protected function schedule(Schedule $schedule): void { $schedule->command('game:ping')->everyMinute(); $schedule->command('attachments:purge')->daily(); $schedule->command('logs:purge')->monthly(); }