Job/Schedule Command in Laravel

1. app/console/kerne.php
    protected $commands = [
        SalesClaimConfirmation::class,
    ];

    protected function schedule(Schedule $schedule)
    {
        // One way
        $schedule->command('job:sales-claim-confirmation')->everyMinute();
        
        // Another way
        $schedule->call('App\Console\Commands\SalesClaimConfirmation@handle')->everyMinute();
    }

2. app/console/commands/SalesClaimConfirmation.php

     // The name and signature of the console command.
     protected $signature = 'job:sales-claim-confirmation';

     // The console command description.
     protected $description = 'Agent sales claim confirmation';

    // Execute the console command.
     public function handle()
    {
        $this->userDefineFunction();
    }

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine