Closed cviebrock closed 8 years ago
That's definitely the best way.
There you go. :)
Not entirely related, but this doesn't work either (if the $data
array has camel-cased keys):
$model = MyCamelCasedModel::where($data)->get();
I think the fix here is rather larger... :worried:
Yeah I won't or wouldn't bother with that - that's dealing directly with the query builder then.
CamelCase functionality was there initially just to deal with JSON responses, and it grew substantially.
I'm pretty sure these methods don't work with camel-casing enabled on the model, since the array of attributes passed to each is simply passed through to the
where()
clause of a query.I think the fix is reasonably simple: overload all these methods in the
CamelCasing
trait, snake_case all the array keys, then return the parent method.Not sure if that's the best way to do it, though. Thoughts?