Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Schedule Not Being Registered #406

Open
surgiie opened this issue Apr 12, 2022 · 3 comments
Open

Command Schedule Not Being Registered #406

surgiie opened this issue Apr 12, 2022 · 3 comments

Comments

@surgiie
Copy link

surgiie commented Apr 12, 2022

I cannot seem to get scheduler to register any commands, it also seems like it happens on a fresh install

Reproducing Steps

Following the install instructions on the docs:

composer create-project --prefer-dist laravel-zero/laravel-zero movie-cli

Make command to test with:

cd movie-cli && php application make:command ExampleCommand

Add schedule on the command:

   /**
     * Define the command's schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    public function schedule(Schedule $schedule): void
    {
        $schedule->command(static::class)->everyMinute();
    }

Listing schedule shows it has not been registered:

php application schedule:list
# No scheduled tasks have been defined.

Unsure if this is a bug or if im just missing something?

@surgiie surgiie changed the title Scheduler Not Registering Commands Command Schedule Not Being Registered Apr 12, 2022
@hsmfawaz
Copy link

I have the same issue

@sebastiaanluca
Copy link

Just set up a Laravel Zero project and was wondering why this wasn't working.

It seems to register only package commands, nothing in app/Commands:

  0 => "Illuminate\Console\Scheduling\ScheduleRunCommand"
  1 => "Illuminate\Console\Scheduling\ScheduleListCommand"
  2 => "NunoMaduro\LaravelConsoleSummary\SummaryCommand"
  3 => "Symfony\Component\Console\Command\DumpCompletionCommand"
  4 => "Symfony\Component\Console\Command\HelpCommand"
  5 => "LaravelZero\Framework\Commands\StubPublishCommand"
  6 => "NunoMaduro\LaravelConsoleSummary\SummaryCommand"
  7 => "LaravelZero\Framework\Commands\BuildCommand"
  8 => "LaravelZero\Framework\Commands\RenameCommand"
  9 => "LaravelZero\Framework\Commands\MakeCommand"
  10 => "LaravelZero\Framework\Commands\InstallCommand"
  11 => "LaravelZero\Framework\Commands\StubPublishCommand"
  12 => "LaravelZero\Framework\Commands\TestMakeCommand"

@manuth
Copy link

manuth commented Apr 17, 2022

@surgiie This is related to issue #408 I have opened a few hours ago.
Basically, laravel-zero tries to preprocess all commands in a point in time where lazy loaded commands aren't accessible.

I'll update the workaround in #408 immediately to include scheduling.
Hope I could help 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants