I've stumbled upon a situation where I didn't want to get all columns to be loaded, in my case because some contain BLOB data. I realized there is an Eloquent "hidden" property to achieve the result, however, this only hides the data, not effectively excludes it from the database query.
I also know there are ways to add a global scope, which is what I ended up doing. However, I found it to be generally useful, perhaps even as part of the default Laravel Eloquent model behavior. Please see my demo below:
I guess it's a minor feature, but could very well been derived from Eloquent, in my opinion.
Anyway, would love to hear what everyone else thinks...
I've stumbled upon a situation where I didn't want to get all columns to be loaded, in my case because some contain BLOB data. I realized there is an Eloquent "hidden" property to achieve the result, however, this only hides the data, not effectively excludes it from the database query.
I also know there are ways to add a global scope, which is what I ended up doing. However, I found it to be generally useful, perhaps even as part of the default Laravel Eloquent model behavior. Please see my demo below:
I guess it's a minor feature, but could very well been derived from Eloquent, in my opinion.
Anyway, would love to hear what everyone else thinks...
Thanks!