I have a large existing database that I would like to access with Laravel/Eloquent.
php artisan ide-helper:models
However my database contains a mix of snake_case and camelCase columns, and whenever I try to access the camelCase column "seoAlias", with code like the following:
$x = AdvertiserModel::whereSeoAlias('someValue')->get();
I get the following error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'seo_alias' in 'where clause'
Does anyone have a solution for accessing a database with a mix of snake_case and camelCase columns using Laravel?
Thanks,
You could use the following if your column name is seoAlias:
$x = AdvertiserModel::where('seoAlias','=','someValue')->get();
This way you will be able to access the database with eloquent without having to rename the columns.