Schedule Command from Packages

LaravelPosted on

Sometimes, during developing a package we need to schedule commands from our package’s service provider. We can do the following to schedule commands as we do in the command kernel:

use Illuminate\Console\Scheduling\Schedule;

// Schedule the commands in the boot method
$this->app->booted(function ($app) {
    $app->make(Schedule::class)->command('your:command')->daily();
});

Need a web developer? Maybe we can help, get in touch!

Looking for web dev job?
You can check them on Jooble.

To see and write comments, you must allow the related (Disqus) cookies. For more information, please visit our privacy policy page.

Similar Posts

More content in Laravel category