I have a lot of users in my DB and there are a lot of user attributes and I think my query is slow because of that.
Is there a way to make a query with eloquent to get all users but only some of their attributes? Now I have a classic one:
$users = User::all();
And I want to get only username, created_at, active. So if I make a blade @foreach ($users as $user) loop and try to get $user->email this should give me an error because i don't need that field.
How to make such a query?
via lewis4u