Kernel.php 1.18 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1 2 3 4
<?php

namespace App\Console;

5
use DB;
Dominik Hebeler's avatar
Dominik Hebeler committed
6 7 8 9 10 11 12 13 14 15 16
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
17

Dominik Hebeler's avatar
Dominik Hebeler committed
18 19 20 21 22 23 24 25 26 27
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
28
        $schedule->command('requests:gather')->everyFifteenMinutes();
29
        $schedule->command('requests:useragents')->everyFiveMinutes();
Dominik Hebeler's avatar
Dominik Hebeler committed
30
        $schedule->command('logs:gather')->everyMinute();
31
        $schedule->command('spam:load')->everyFiveMinutes();
32 33
        $schedule->call(function () {
            DB::table('monthlyrequests')->truncate();
Dominik Hebeler's avatar
Dominik Hebeler committed
34
            DB::disconnect('mysql');
35
        })->monthlyOn(1, '00:00');
36 37 38 39 40 41 42 43 44 45
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
46
        $this->load(__DIR__ . '/Commands');
Dominik Hebeler's avatar
Dominik Hebeler committed
47 48
    }
}