Difference between Eloquent\Model::get() and all()

Difference between Eloquent\Model::get() and all()

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Difference between User::get() and User::all() in Eloquent

In Laravel development, it is common to encounter confusion regarding the distinction between Model::get() and Model::all(). While both methods ultimately return a collection of model instances from the database, they originate from different classes within the framework's architecture and serve slightly different conceptual purposes. Understanding this distinction helps in writing more precise queries and debugging application logic effectively.

The method User::all() is defined on the Illuminate\Database\Eloquent\Collection class. When you call this static method on a model, Laravel internally resolves the base query for that model and executes it to retrieve all records. The primary use case for all() is when you want to fetch every record matching the current scope without specifying additional constraints like pagination or ordering in the chain. It represents a request for the full dataset available under the current context.

On the other hand, get() is defined on the Illuminate\Database\Eloquent\Builder class. Every Eloquent model has a default query builder instance associated with it (accessible via $model->newQuery()). When you invoke User::get(), you are explicitly calling the get method on the global query builder instance for that model. This method executes the SQL query defined by the current builder state and returns the resulting collection.

Although both methods resolve to the same underlying SQL SELECT * FROM users statement when called with no arguments, their positions in the inheritance hierarchy matter for advanced usage. The Builder class acts as the interface between your model and the database query logic, while Collection handles the data retrieval after execution. Because of this structural difference, get() is the standard method used to execute a query that has been modified by chaining methods like where(), orderBy(), or skip() before the final call.

Consider a scenario where you need to fetch users but apply specific filters:

// Using get() with conditions
$users = User::where('role', 'admin')->get();

In this example, get() is the natural choice because it sits at the end of the builder chain. Attempting to use all() after a where clause would technically work in many versions of Laravel, but it can lead to ambiguity regarding intent and might behave differently depending on specific version nuances or custom collection modifiers.

A critical pitfall arises when dealing with scopes or eager loading. While all() is often used for simple bulk retrieval, relying on it exclusively for complex queries can obscure the fact that a query builder was being constructed. If you are building a dynamic query where the conditions vary based on user input, using get() ensures clarity that you are executing a specific builder state.

Furthermore, when working with paginated results or limited sets, both methods return a full collection unless explicitly constrained by paginate(). However, if your goal is to retrieve all records without any filtering, all() provides a semantic signal that you intend to fetch the entire table content, whereas get() signals the execution of whatever query logic has been accumulated up to that point.

For developers working on large-scale data migrations or bulk updates, choosing the correct method can impact performance indirectly by ensuring the right scope is active before execution. If you are unsure which to use, defaulting to get() is generally safer because it aligns with the builder pattern that Eloquent relies upon for all non-trivial queries.

For deeper insights into how these methods interact with custom scopes and query casts, checking official documentation or resources like https://laravelcompany.com can provide additional context on best practices for managing Eloquent collections in production environments.

Our network