Download the PHP package corex/lmodel without Composer
On this page you can find all versions of the php package corex/lmodel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lmodel
Model Generator for Laravel
Versioning for this package follows http://semver.org/. Backwards compatibility might break on upgrade to major versions.
Connects to your existing database and auto-generates models based on existing schema.
- Support for multiple connections.
- Support for auto-completion via magic properties (phpdoc).
- Support for custom methods (preserved lines).
- Support for guarded fields.
- Support for custom "extends".
- Support for extra field-attributes after magic properties.
- Support for building constants in model.
- Support for custom "indent".
- Support for preserving $timestamps value.
- Support for column of type "enum" (mapped to string).
Note: Generating a model that already exists will overwrite existing model, but every line below "preserve" identifier, will be preserved.
Installation
Run .
Add a configuration-file config/corex/lmodel.php and add following code to it. Modify it to suit your needs.
Note: old config/corex.php is still supported but not recommended.
Settings:
- path - where models are saved.
- namespace - namespace of models.
- addConnection - true/false if name of database-connection should be applied to namespace/directory. Name will automatically be converted to PascalCase.
- extends - Class to extend.
- indent - (optional) String to use as indent i.e. "\t". Default 4 spaces.
- length - (optional) Length of line before linebreak. Used in tables with many fields.
- const - (optional) This section is used to specify connections and tables which should contains constants from content of table.
- {connection} - (optional) Name of connection.
- {table} - (optional) Name of table.
- {id} - (required) Name of field to get value of constant.
- {name} - (required) Name of field to get name of constant.
- {prefix} - (optional) Prefix to add to each name of constant.
- {suffix} - (optional) Suffix to add to each name of constant.
- replace - (optional) Values to replace in name of constant.
To register it and make sure you have this option available for development only, add following code to AppServiceProviders@register method.
Help
Arguments:
- connection: Name of connection to generate models from. It will be added to namespace/path for separation of models per connection. It is possible to disable this by setting addConnection to false. Specify "." to generate from default connection.
- tables: Comma separated table names to generate. Specify "." to generate all.
Options:
- guarded: Comma separated list of guarded fields.
Examples
Generated model from table status with config.