Php artisan schedule dosen't execute the command so I'am trying to run a task with laravel schedule and php schedule:run works well but it does not execute the command in real
There is my kernel class
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//$schedule->exec('php artisan migrate:fresh')->everyMinute();
$schedule->command('migrate:fresh')->everyMinute();
}
}
And the result of php schedule:run
Running scheduled command: '/usr/bin/php7.2' artisan migrate:fresh > '/dev/null' 2>&1
I found the solution, i had to use the --force in the migrate command.
And by the way i have another question, i have to do some tests to my database every x time, so what's the best way to do it? create a controller and do the call from the schedule or do the test in commands folder ?
Please sign in or create an account to participate in this conversation.