Difference Between Eloquent\Model::get() And All()

- 1 answer

What is the difference between uses User::all() and User::get() on Eloquent?

On Laravel API it describes only all() on Eloquent\Model.
Maybe get() is described on Eloquent\Builder.



User::all() and User::get() will do the exact same thing.

all() is a static method on the Eloquent\Model. All it does is create a new query object and call get() on it. With all(), you cannot modify the query performed at all (except you can choose the columns to select by passing them as parameters).

get() is a method on the Eloquent\Builder object. If you need to modify the query, such as adding a where clause, then you have to use get(). For example, User::where('name', 'David')->get();.