Closed stefensuhat closed 7 years ago
Can you provide more information? This project is used by quite a few and the key feature is camel cased fields.
@kirkbushell I'm building an SPA project with laravel as backend.
From my front end i send this data {firstName: "Example", email: "example@example.com", password: "asdasd"}
but on receiving to the server, I can only saved the email and password. the firstName input is being ignored (because may be the database column is first_name).
You need to provide some code. I am unable to reproduce this and use the library on a 500k lines project with no issues with camel casing. I also run a SPA with laravel as backend.
My first assumption is you're not including the trait or extending a base model that includes it.
@kirkbushell at my model User.php
class User extends Authenticatable
{
use Notifiable, CamelCasing, Uuid;
protected $fillable = [
'name', 'email', 'first_name', 'last_name', 'gender', 'phone'
];
}
my controller only simple:
$user = new User($request->all());
$user->save();
You're not using camel case in your fillable attributes.
for example:
On saving to database , the firstName value is not saved. I see you have setAttribute function but seems to not working convert it to snake case.