mercredi 24 avril 2019

my cron job not working well in laravel it work only once

i am working on laravel crone job it work only one time my code execute only one time i am a beginer

protected function schedule(Schedule $schedule) {

    $schedule->command('list:users')->everyMinute();



}

class ListUsers extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'list:users';

/**
 * The console command description.
 *
 * @var string
 */
protected $description = 'corn job command';

/**
 * Create a new command instance.
 *
 * @return void
 */
public function __construct()
{
    parent::__construct();
}

/**
 * Execute the console command.
 *
 * @return mixed
 */
public function handle()
{

    $totalUsers = \DB::table('users')->whereMonth('created_at','04')->count();
    Mail::to('qasim@gmail.com')->send(new SendMailable($totalUsers));


}

i am also try this code protected function schedule(Schedule $schedule) {

    $schedule->call(function () {
        echo "pakistan\n";
        $totalUsers = \DB::table('users')->whereMonth('created_at','04')->count();
        Mail::to('qasim@gmail.com')->send(new SendMailable($totalUsers));
        echo "pakistan";
    })->everyMinute();

}

i want user recieve email after every minute i recieve mail once but not every minute



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2UwN2Kx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire