Laravel 5.6: Execute command every minute

0

Create a command to send an email, test the command executing it in the console and it works perfectly. However I want it to be done automatically without having to enter the command in the console. I added it to the kernel so that it runs every minute:

<?php

namespace efsystem\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
 * The Artisan commands provided by your application.
 *
 * @var array
 */
protected $commands = [
    Commands\SendEmailEfsystem::class,
];

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    $schedule->command('emails:send')->everyMinute();
}

/**
 * Register the commands for the application.
 *
 * @return void
 */
protected function commands()
{
    $this->load(__DIR__.'/Commands');

    require base_path('routes/console.php');
}
}

I just do not know how to start the process so that the command starts running every minute. I'm using Xammp.

    
asked by Kinafune 11.10.2018 в 04:14
source

1 answer

0

You have to set a Cron, I'll give you an example:

link

    
answered by 11.10.2018 в 04:43