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

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

Deploy laravel application to digital ocean droplet