Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Azuriom/Azuriom

703 stars
2 code files
View Azuriom/Azuriom on GitHub

app/Console/Commands/GamePingCommand.php

Open in GitHub
use 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 GitHub
class 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();
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.