laravel - 检查下一个运行 Laravel 的时间表是什么时候
问题描述
有什么方法可以查看下一个schedule
命令何时运行?
例子:
$schedule->command("update:example")->dailyAt('07:00')->withoutOverlapping();
现在是2020-09-23 08:00:00
,计划运行的下一个时间戳应该是2020-09-24 07:00:00
.
有办法2020-09-24 07:00:00
在它真正发生之前得到它吗?
我刚刚找到有关日志的文章,这不是我想要的。
解决方案
您可以获得所有任务并通过它们来找到您需要的内容
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Str;
$schedule = app(Schedule::class);
$tasks = collect($schedule->events());
$matches = $tasks->filter(function ($item) {
return Str::contains($item->command, 'update:example');
});
// assuming you get something back in that collection
$matches->first()->nextRunDate();
你应该得到一些你需要的碳对象。
希望对您有所帮助。
推荐阅读
- react-native - React native : can't unzip the file I get with rn-fetch-blob
- sql - 具有多个线外约束的 ALTER TABLE 的铁路图不正确?
- amazon-dynamodb - 修改键属性时复制 DynamoDB 表
- perl - 使用 call_sv() 将数组引用传递给 perl 回调,我应该使用 newRV() 还是 newRV_noinc()?
- android - 谷歌日历 CRUD 编程
- paypal - Paypal 订阅,检查用户是否支付了下个月的费用
- java - 通过多线程读取大文件和进程
- vba - 运行时错误“91”:对象变量或未设置块变量目录邮件合并
- spring-boot - 如何将一个 Spring Boot 应用程序的引用添加到另一个 Spring Boot 应用程序
- reactjs - 我可以使用 Hooks 发布库吗?