本文整理汇总了PHP中Illuminate\Console\Scheduling\Schedule::dueEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::dueEvents方法的具体用法?PHP Schedule::dueEvents怎么用?PHP Schedule::dueEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Console\Scheduling\Schedule
的用法示例。
在下文中一共展示了Schedule::dueEvents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$events = $this->schedule->dueEvents($this->laravel);
foreach ($events as $event) {
$this->line('<info>Running scheduled command:</info> ' . $event->getSummaryForDisplay());
$event->run($this->laravel);
}
if (count($events) === 0) {
$this->info('No scheduled commands are ready to run.');
}
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$events = $this->schedule->dueEvents($this->laravel);
$eventsRan = 0;
foreach ($events as $event) {
if (!$event->filtersPass($this->laravel)) {
continue;
}
$this->line('<info>Running scheduled command:</info> ' . $event->getSummaryForDisplay());
$event->run($this->laravel);
++$eventsRan;
}
if (count($events) === 0 || $eventsRan === 0) {
$this->info('No scheduled commands are ready to run.');
}
}
示例3: schedule
/**
* This method is nearly identical to ScheduleRunCommand shipped with Laravel, but since we are not interested
* in console output we couldn't reuse it
*
* @param Container $laravel
* @param Kernel $kernel
* @param Schedule $schedule
* @return array
*/
public function schedule(Container $laravel, Kernel $kernel, Schedule $schedule)
{
$events = $schedule->dueEvents($laravel);
$eventsRan = 0;
$messages = [];
foreach ($events as $event) {
if (method_exists($event, 'filtersPass') && (new \ReflectionMethod($event, 'filtersPass'))->isPublic() && !$event->filtersPass($laravel)) {
continue;
}
$messages[] = 'Running: ' . $event->getSummaryForDisplay();
$event->run($laravel);
++$eventsRan;
}
if (count($events) === 0 || $eventsRan === 0) {
$messages[] = 'No scheduled commands are ready to run.';
}
return $this->response($messages);
}