本文整理匯總了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);
}