new command

This commit is contained in:
2020-03-04 00:24:11 -06:00
parent b9044b077f
commit 3292b369de
2 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands;
//Internal Library
use Illuminate\Console\Command;
use Carbon\Carbon;
//Models
use App\Models\Wormholes\AllianceWormhole;
class PurgeWormholes extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:PurgeWormholeData';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Purge stale wormhole data automatically';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Time of now
$currentTime = Carbon::now();
AllianceWormhole::where('created_at', '<', $currentTime->subHours(48))->delete();
}
}

View File

@@ -26,6 +26,7 @@ class Kernel extends ConsoleKernel
Commands\PurgeUsers::class, Commands\PurgeUsers::class,
Commands\FlexStructureCommand::class, Commands\FlexStructureCommand::class,
Commands\EmptyJumpBridges::class, Commands\EmptyJumpBridges::class,
Commands\PurgeWormholes::class,
]; ];
/** /**
@@ -71,6 +72,9 @@ class Kernel extends ConsoleKernel
$schedule->command('services:FlexStructures') $schedule->command('services:FlexStructures')
->monthlyOn(2, '00:01') ->monthlyOn(2, '00:01')
->withoutOverlapping(); ->withoutOverlapping();
//Wormhole data purge
$schedule->command('services:PurgeWormholeData')
->hourlyAt(20);
//Horizon Graph Schedule //Horizon Graph Schedule
$schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('horizon:snapshot')->everyFiveMinutes();