Closed mrahmadt closed 4 years ago
The interesting thing is specifying the columns within the ->get('...')
method works, but specifying it through ->select('...')
doesn't. So as a temporary workaround, maybe you should put your columns in ->get()
instead of ->select()
, like below:
Child::where(['user_id' => $request->auth->id])->get(['id', 'name']);
Environment
Excellent.
Thanks, this is working fine when I put columns in get().
Keeping this issue open to investigate the select()
issue.
This is indeed a bug, will need to ponder on this a while to see how to implement this. Will welcome any PRs for this that satisfy the test testSelectFieldsAreCached()
(current commented out). While I have the cache key differentiating, the results still contain all columns. Intercepting the select
clause is a challenge.
@mikebronner I think this one can be closed the test seems to pass?
@dmason30 Thanks for checking on this! :)
Describe the bug Query database with deferent fields (and same "where" statement) will return the first cached result without respecting the requested/selected fields
Eloquent Query
Environment