diff --git a/content/collections/repositories/entry-repository.md b/content/collections/repositories/entry-repository.md index 2b40a888a..148c17564 100644 --- a/content/collections/repositories/entry-repository.md +++ b/content/collections/repositories/entry-repository.md @@ -23,6 +23,7 @@ use Statamic\Facades\Entry; | `all()` | Get all Entries | | `find($id)` | Get Entry by `id` | | `findByUri($uri, $site)` | Get Entry by `uri`, optionally in a site | +| `findByIds([$ids])` | Get Entries by `id`. Returns in same order as `$ids`. | | `findOrFail($id)` | Get Entry by `id`. Throws an `EntryNotFoundException` when the entry cannot be found. | | `query()` | Query Builder | | `whereCollection($handle)` | Get all Entries in a `Collection` | @@ -61,6 +62,14 @@ Entry::findByUri('/blog/my-first-post'); **What is the difference between `URI` and `URL`?** `URL` includes the site root (e.g. `/fr/` in a multisite), if there is one, while `URI` is site agnostic and will not. As you may have surmised, when you only have a single site — they are identical. ::: +#### Get multiple entires in a specific order by id + +You may want to find some entries and have them returned in a specific order. Whilst you can use the query builder to do this, it is much more simple with the repository’s `findByIds()` method: + +```php +Entry::findByIds([ 3, 1, 2 ]); +``` + #### Get all entries in a collection ```php