Skip to content

Commit

Permalink
Inline CronService
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio committed Oct 30, 2019
1 parent 12a7cd8 commit df20892
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,10 @@
use App\Console\Cron\Weekly;
use App\Services\CronService;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
private $cronSvc;

public function __construct(Application $app, Dispatcher $events)
{
parent::__construct($app, $events);
$this->cronSvc = app(CronService::class);
}

/**
* Define the application's command schedule.
*
Expand All @@ -41,7 +31,8 @@ protected function schedule(Schedule $schedule): void
$schedule->command('backup:run')->daily()->at('02:00');

// Update the last time the cron was run
$this->cronSvc->updateLastRunTime();
$cronSvc = app(CronService::class);
$cronSvc->updateLastRunTime();
}

/**
Expand Down

0 comments on commit df20892

Please sign in to comment.