Entry
Statamic\API\Entry
Get all entries.
Entry::all(); // Returns EntryCollection
Get all entries in a collection
Entry::whereCollection($collection); // Returns EntryCollection
Get the number of entries in a collection
Entry::countWhereCollection($collection); // Returns an integer
This is significantly more performant than using Entry::whereCollection($collection)->count();
.
Get an entry by ID.
Entry::find($id); // Returns Entry
Get an entry by slug (and collection).
Entry::whereSlug($slug, $collection); // Returns Entry
Get an entry by URI.
Entry::whereUri($uri); // Returns Entry
Check if an entry exists.
Entry::exists($id); // Returns a boolean
Check if an entry exists by slug.
Entry::slugExists($slug, $collection); // Returns a boolean
Create an entry.
This returns an instance of a EntryFactory
to allow you to chain and build your entry.
Entry::create($slug); // Returns EntryFactory
Import using:
use Statamic\API\Entry