Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

Hi gnardella,

Try to use php artisan generators (Way Generators) so you can save the name mistakes creating models.

php artisan generate:model

You can specify the --path, --templatePath and modelName as parameters to the Artisan CLI function.

Hope it helps you.

Last updated 2 years ago.
0

codeATbusiness said:

Hi gnardella,

Try to use php artisan generators (Way Generators) so you can save the name mistakes creating models.

php artisan generate:model

You can specify the --path, --templatePath and modelName as parameters to the Artisan CLI function.

Hope it helps you.

I tried

php artisan genrate:model LocationsTipo

but the result is the same. After if I change LocantionsTipo to Locationstipo all works.

Last updated 2 years ago.
0

Hi, i think you can add the following line below of your class beginning:

class LocationsTipo extends Eloquent{
  public static $snakeAttributes = false; //if false enable to you to use camelcase notation

}

Hope it helps you.

Last updated 2 years ago.
0

I'm sorry, but it doesn't work.

Last updated 2 years ago.
0

Why do you try to rename the model to LocationType?. The model name needs to be singular and if you use a table you could use LocationTypes as a database table name.

Hope it helps you.

Last updated 2 years ago.
0

Thanks

Last updated 2 years ago.
0

You are welcome.

By the way, you could tell to your model the table to use if you don't want to limit to pluralize options of Laravel.

class LocationType extends Eloquent{
   protecte $table = "LocationTypes";

   //the other properties and methods

}

Hope helps you.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

gnardella gnardella Joined 27 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.