public function boot()
    {
        // Get the schedule config
        $config = $this->app->make(AbstractConfig::class);
        $scheduleConfig = $config->scheduleConfig();

        // Run only if schedule is enabled
        if (true === Arr::get($scheduleConfig, 'enabled', false)) {
            // Wait until the app is fully booted
            $this->app->booted(function () use ($scheduleConfig) {
                // Get the scheduler instance
                /** @var Schedule $schedule */
                $schedule = $this->app->make(Schedule::class);

                // Register the clear chunks with custom schedule
                $schedule->command('uploads:clear')
                    ->cron(Arr::get($scheduleConfig, 'cron', '* * * * *'));
            });
        }

        $this->registerHandlers($config->handlers());
    }
public function boot()
    {
        // Get the schedule config
        $config = $this->app->make(AbstractConfig::class);
        $scheduleConfig = $config->scheduleConfig();

        // Run only if schedule is enabled
        if (true === Arr::get($scheduleConfig, 'enabled', false)) {
            // Wait until the app is fully booted
            $this->app->booted(function () use ($scheduleConfig) {
                // Get the scheduler instance
                /** @var Schedule $schedule */
                $schedule = $this->app->make(Schedule::class);

                // Register the clear chunks with custom schedule
                $schedule->command('uploads:clear')
                    ->cron(Arr::get($scheduleConfig, 'cron', '* * * * *'));
            });
        }

        $this->registerHandlers($config->handlers());
    }
public function boot ( ) { // Get the schedule config $ config = $ this -> app -> make ( AbstractConfig :: class ) ; $ scheduleConfig = $ config -> scheduleConfig ( ) ; // Run only if schedule is enabled if ( true === Arr :: get ( $ scheduleConfig , 'enabled' , false ) ) { // Wait until the app is fully booted $ this -> app -> booted ( function ( ) use ( $ scheduleConfig ) { // Get the scheduler instance /** @var Schedule $schedule */ $ schedule = $ this -> app -> make ( Schedule :: class ) ; // Register the clear chunks with custom schedule $ schedule -> command ( 'uploads:clear' ) -> cron ( Arr :: get ( $ scheduleConfig , 'cron' , '* * * * *' ) ) ; } ) ; } $ this -> registerHandlers ( $ config -> handlers ( ) ) ; }
When the service is being booted.
When the service is being booted .