Auto-generate models for a Laravel 5 project.
mrcorex/laravel-model-generator is a Laravel package for auto-generate models for a laravel 5 project..
It currently has 1 GitHub stars and 2.204 downloads on Packagist (latest version 1.3.3).
Install it with composer require mrcorex/laravel-model-generator.
Discover more Laravel packages by mrcorex
or browse all Laravel packages to compare alternatives.
Last updated
Auto-generate models for a Laravel 5 project.
Note: it is recommended to abandon this package and use corex/lmodel instead. It is more up-to-date and uses doctrine/dbal instead of native sql + other advantages. There are a few changes in configuration but easy to convert config to corex/lmodel.
You can continue to use this package. I will do my best to support future versions.
Only MySQL will be supported.
Connects to your existing database and auto-generates models based on existing schema.
Run "composer require mrcorex/laravel-model-generator".
Add a configuration-file called corex and add following code to it. Modify it to suit your needs.
return [
'laravel-model-generator' => [
'path' => base_path('app/Models'),
'namespace' => 'App\Models',
'databaseSubDirectory' => true,
'extends' => '',
'indent' => "\t",
'uses' => [],
'const' => [
'{connection}' => [
'{table}' => [
'id' => '{id}',
'name' => '{name}',
'prefix' => '{prefix}',
'suffix' => '{suffix}',
'replace' => [
'XXXX' => 'YYYY',
]
]
]
]
]
];
Settings:
To register it and make sure you have this option available for development only, add following code to AppServiceProviders@register.
public function register()
{
if ($this->app->environment() == 'local') {
$this->app->register('CoRex\Generator\ModelGeneratorProvider');
}
}
php artisan help make:models
Arguments:
Options: