Skip to content

Commit

Permalink
get all the revisions that are ready to be published
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Feb 27, 2025
1 parent aeec914 commit 5837d5e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Entries/MinuteScheduledRevisionEntries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Statamic\Entries;

use Carbon\CarbonInterface;
use Illuminate\Support\Collection;
use Statamic\Facades\Entry as EntryFacade;

class MinuteScheduledRevisionEntries
{
public function __construct(private readonly CarbonInterface $minute) {}

public function __invoke(): Collection
{
return EntryFacade::all()
->filter(fn (Entry $entry) => $entry->hasRevisions())
->filter(fn (Entry $entry) => $entry->latestRevision()->publishAt())
->filter(
fn (Entry $entry) => $entry
->latestRevision()
->publishAt()
->isSameMinute($this->minute)
);
}
}

0 comments on commit 5837d5e

Please sign in to comment.