Viewing File: /home/ubuntu/vedadeals-backend-base/app/Console/Kernel.php

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

use App\Jobs\{ GenerateSiteMapJob };

use Setting;

use App\Models\{ Settings };

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {

        if(Setting::get('sitemap_date') == now(IST_TIMEZONE)->format('Y-m-d')) {

            $schedule->job(new GenerateSiteMapJob);

            Settings::where(['key' => 'sitemap_date'])->update(['value' => now(IST_TIMEZONE)->addDays(3)->format('Y-m-d')]);
        }
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
Back to Directory File Manager