3 namespace BookStack\Entities\Queries;
5 use BookStack\Entities\Models\Entity;
6 use Illuminate\Database\Eloquent\Builder;
9 * Interface for our classes which provide common queries for our
10 * entity objects. Ideally all queries for entities should run through
12 * Any added methods should return a builder instances to allow extension
13 * via building on the query, unless the method starts with 'find'
14 * in which case an entity object should be returned.
15 * (nullable unless it's a *OrFail method).
17 interface ProvidesEntityQueries
20 * Start a new query for this entity type.
22 public function start(): Builder;
25 * Find the entity of the given ID, or return null if not found.
27 public function findVisibleById(int $id): ?Entity;
30 * Start a query for items that are visible, with selection
31 * configured for list display of this item.
33 public function visibleForList(): Builder;