php - Laravel 任务计划程序只运行一次命令
问题描述
嗨,我知道有类似的主题,但我的问题是关于本地服务器(windows artisan 服务器)当我运行 php artisan schedule:run 电子邮件通知仅第一次运行时,调度程序在本地或共享服务器上都不起作用。
MinuteUpdate.php
public function handle()
{
$users = User::all();
foreach ($users as $user) {
Mail::to($user->email)->send(new CrendentialsNotify($user->name,$user->email,$user->plate));
$this->info('Minute Update');
}
}
内核.php
<?php
namespace App\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\MinuteUpdate::class
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('minute:update')->everyMinute();
// $schedule->command('check:reserve')->everyMinute();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
解决方案
推荐阅读
- python - 为什么我的代码有时会识别“?!” 作为符号,有时不是
- r - map2 函数的不同大小向量错误
- python - Uva The 3n + 1 Problem - Python 的错误答案
- javascript - 如果另一个 div 有一个类,则将类添加到一个 div
- docker - 如何使用 maven jib 插件创建 muttilayer 图像
- python - 即使 url 模式正确,也获得 NoReverseMatch?
- firebase - Firestore 查询不会返回具有 Geo Flutter Fire 的附近位置
- r - R Boxplot.stats 未识别异常值
- c# - Oracle 快速连接故障转移不适用于 ODP.NET。获取连接请求超时错误
- javascript - 当我的鼓垫触发 onClick 功能时如何设置状态?