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 the models have set $snakeAttributes = false.
So column fooBar will be attribute fooBar and column foo_bar will become attribute foo_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 to false and let the ide helper generate the PHPDoc accordingly?
Steps To Reproduce:
Have a model with $snakeAttributes = false
Have a database column on that model in camelCase
Have a database column on that model in snake_case
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 ;)