$record = Record::all();
$record::where('user_id',1)->get();
CodePudding user response:
with all() you cannot modify the query get() you can modify the query such as adding a where to it.
CodePudding user response:
Record::all()
and Record::get()
are the same thing.
However all()
is a static method on the Eloquent\Model. What is does is create a new query object and call get()
on the new object. With all()
you're unable to modify the performed query.
get()
is a method on the Eloquent\Builder object. get()
is useful if you need to modify you're query, like adding a where clause for example.