where('status', CallStatus::Open) ->whereNotNull('closes_at') ->where('closes_at', '<', now()) ->get(); foreach ($expired as $call) { $title = $call->getTranslation('title', (string) config('locales.default'), false); $this->components->twoColumnDetail( $title ?: "#{$call->id}", ''.__('console.schedule.closed').'', ); if (! $this->option('dry-run')) { $call->update(['status' => CallStatus::Closed]); } } $this->report(); $this->components->info( trans_choice('console.schedule.summary', $expired->count(), ['count' => $expired->count()]) ); return self::SUCCESS; } /** * What the dates are about to do on their own. Nothing here needs acting * on; it is here so that a scheduled release is visible in the logs before * it happens rather than only afterwards. */ protected function report(): void { $pending = Page::query()->scheduled()->count() + Project::query()->scheduled()->count(); $expiring = Page::query()->expired()->count() + Project::query()->expired()->count(); if ($pending > 0) { $this->components->twoColumnDetail(__('console.schedule.pending'), (string) $pending); } if ($expiring > 0) { $this->components->twoColumnDetail(__('console.schedule.off_site'), (string) $expiring); } } }