Retrieving data
Collections and single documents
$users = User::all();
$user = User::find('user-123');
$user = User::findOrFail('user-123');
$user = User::where(['email', 'person@example.com'])->first();
$user = User::where(['email', 'person@example.com'])->firstOrFail();
all() returns an Illuminate\Support\Collection and may be expensive on a large collection. Use a bounded query or pagination when the collection can grow.
Execute a query
$users = User::where([
['status', '=', 'active'],
['age', '>=', 18],
])->orderByDesc('created_at')->limit(50)->get();
get() returns an Illuminate\Support\Collection. Do not call get() without a filter, order, limit, offset, or selection; use all() for an unstructured collection read.
Specialized filters
User::whereIn('role', ['admin', 'staff'])->get();
User::whereNotIn('status', ['blocked'])->get();
User::whereContains('skills', 'php')->get();
User::whereContainsAny('skills', ['php', 'laravel'])->get();
User::whereDate(['created_at', '>=', '2026-01-01'])->get();
whereContains() and whereContainsAny() query Firestore array fields; they are not substring searches.
Pagination
$users = User::orderByDesc('created_at')->cursorPaginate(20);
See Pagination and large result sets for cursor, simple, numbered, Livewire, chunk, and lazy examples.
Full query reference
See the Query builder for filters, ordering, selected fields, aggregates, and write methods.