Removing CleanHistory
This commit is contained in:
parent
3cdeded7a2
commit
3a288ff15f
2 changed files with 51 additions and 2 deletions
51
app/Console/Commands/CleanHistory.php
Normal file
51
app/Console/Commands/CleanHistory.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class CleanHistory extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'monitolite:history:clean';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Aggregates and cleans tasks history';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$lastweek = \Carbon\Carbon::now()->subWeek();
|
||||||
|
$history = app('db')->select('
|
||||||
|
SELECT * FROM tasks_history as h
|
||||||
|
WHERE datetime < :lastweek
|
||||||
|
', [
|
||||||
|
'lastweek' => $lastweek
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Console;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
|
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
|
||||||
use App\Console\Commands\SyncCustomers;
|
use App\Console\Commands\SyncCustomers;
|
||||||
use App\Console\Commands\CleanHistory;
|
|
||||||
use App\Console\Commands\RunMonitoring;
|
use App\Console\Commands\RunMonitoring;
|
||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
|
@ -17,7 +16,6 @@ class Kernel extends ConsoleKernel
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
SyncCustomers::class,
|
SyncCustomers::class,
|
||||||
CleanHistory::class,
|
|
||||||
RunMonitoring::class
|
RunMonitoring::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue