Models that have static::$snakeAttributes
set to true
should use attribute names without case conversion
#1500
Labels
static::$snakeAttributes
set to true
should use attribute names without case conversion
#1500
Versions:
Description:
If I understand the code in
\Illuminate\Database\Eloquent\Concerns\HasAttributes
that relies on the\Illuminate\Database\Eloquent\Concerns\HasAttributes::$snakeAttributes
property correctly, the column namens coming from the database are used untouched as attributes in themodels
have set$snakeAttributes = false
.So column
fooBar
will be attributefooBar
and columnfoo_bar
will become attributefoo_bar
.In the config we have the variable
model_camel_case_properties
which can be used to configure the behavior of the ide helper during generation of model php docs.It is as document an "all or nothing" approach.
Instead of that, could we just see in the models, which as far as I understand are reflected and inspected anyway, check for that
$snakeAttributes
property being set tofalse
and let the ide helper generate the PHPDoc accordingly?Steps To Reproduce:
$snakeAttributes = false
camelCase
snake_case
Should be something along the lines:
What do you think?
I am fairly new to Laravel, Eloquent and the sorts, so I appreciate any new insights you can give me into this :)
P.S.: Thanks for your awesome work ;)
The text was updated successfully, but these errors were encountered: