iberflow / laravel-model-generator

Laravel 5 model generator for an existing schema
264 stars 76 forks source link

rtrim for s sufix issue #11

Closed kaseka closed 8 years ago

kaseka commented 8 years ago

This library automatically remove all "s" from the end of a table name. It's good idea, but this option should be controlled by some command line parameter. For example if we got table called "address" then class generated is called "addre" - and that's the case which I had.

If I good understand the code it's at MakeModelsCommand:147:

$name = rtrim($this->parseName($prefix . $class), 's');

Would You mind to make such change? Regards

ghost commented 8 years ago

Import the Illuminate\Support\Pluralizer class, then replace the line:

$name = rtrim($this->parseName($prefix . $class), 's');

with:

$name = Pluralizer::singular($this->parseName($prefix . $class));

Worked perfectly for me.