PHPackages                             itm2018/eloquent-model-generator-for-lumen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. itm2018/eloquent-model-generator-for-lumen

ActiveLibrary[Database &amp; ORM](/categories/database)

itm2018/eloquent-model-generator-for-lumen
==========================================

Eloquent Model Generator, forked from asamaru7/eloquent-model-generator

1.0.8(8y ago)069MITPHP

Since Apr 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/itm2018/eloquent-model-generator)[ Packagist](https://packagist.org/packages/itm2018/eloquent-model-generator-for-lumen)[ RSS](/packages/itm2018-eloquent-model-generator-for-lumen/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (10)Used By (0)

Eloquent Model Generator for lumen version &gt; 5.6
===================================================

[](#eloquent-model-generator-for-lumen-version--56)

Eloquent Model Generator is a tool based on [Code Generator](https://github.com/krlove/code-generator) for generating Eloquent models.

Installation
------------

[](#installation)

Step 1. Add Eloquent Model Generator to your project:

```
composer require itm2018/eloquent-model-generator-for-lumen --dev

```

Step 2. Register `GeneratorServiceProvider`:

```
'providers' => [
    // ...
    Krlove\EloquentModelGenerator\Provider\GeneratorServiceProvider::class,
];
```

Step 3. Configure your database connection.

Usage
-----

[](#usage)

Use

```
php artisan krlove:generate:model User

```

to generate a model class. Generator will look for table with name `users` and generate a model for it. You can specify another table name by supplying `table-name` option:

```
php artisan krlove:generate:model User --table-name=user

```

In this case generated model will contain `protected $table = 'user'` property.

Generated file will be saved into `app` directory of your application and have `App` namespace. If you want to change the destination and namespace, supply the `output-path` and `namespace` options respectively:

```
php artisan krlove:generate:model User --output-path=/full/path/to/output/directory --namespace=Some\\Other\\NSpace

```

By default generated class will be extended from `Illuminate\Database\Eloquent\Model`. To change the base class specify `base-class-name` option:

```
php artisan krlove:generate:model User --base-class-name=Some\\Other\\Base\\Model

```

There are several useful options for defining several model's properties:

- `no-timestamps` - adds `public $timestamps = false;` property to the model
- `date-format` - specifies `dateFormat` property of the model
- `connection` - specifies connection name property of the model

Instead of spcifying options each time when executing the command you can create a config file with your own default values and pass it by specifying `config` option. Generator already contains its own config file at `Resources/config.php`:

```
