Replies: 1 comment
-
This would be extremely useful for full custom queries that skip Eloquent, yet still want to use casting features of Laravel like created_at -> datetime. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pretty much the proposal made here:
laravel/ideas#2134
withCasts
is available on Eloquent queries, but is not available on the query builder. This would be useful, for example when making JSON columns with DB::raw (e.g. MySQL's JSON_ARRAYAGG).I can work around it by forcing the query through Eloquent's query builder, but this seems less than ideal (not least because I need to add
withTrashed()
to prevent query builder adding aWHERE deleted_at IS NULL
- even though I am not selecteddeleted_at
in my query).Beta Was this translation helpful? Give feedback.
All reactions