Skip to content

Each artisan command executes App\Console\Kernel schedule() method #12798

@sergey-rud

Description

@sergey-rud

Laravel 5.2.23
Main issue is that each artisan command executes App\Console\Kernel schedule() method.

On my App\Console\Kernel schedule() method I have next code:

<?php
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule $schedule
     *
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $user = User::find(1);

        if (!empty($user)) {
            $schedule->call(function () use ($user) {
                $user->changePassword();
            })->cron($user->getCron());
        }
    }

Problems:
For example, I need to deploy my project from scratch - I can't do this because when I execute

php artisan migrate

I get an error: ""Table 'users' doesn't exists"". So at present I should comment out body of method shedule(), run migrations, then uncomment body of shedule() method.

Suggestions?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions