Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reliese Laravel Model Generator

License

NotificationsYou must be signed in to change notification settings

reliese/laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusLatest Stable VersionTotal DownloadsLatest Unstable VersionLicense

Reliese Laravel Model Generator aims to speed up the development process of Laravel applications byproviding some convenient code-generation capabilities.The tool inspects your database structure, including column names and foreign keys, in orderto automatically generate Models that have correctly typed properties, along with any relationships to other Models.

How does it work?

This package expects that you are using Laravel 5.1 or above.You will need to import thereliese/laravel package via composer:

Configuration

It is recommended that this package should only be used on a local environment for security reasons. You should install it via composer using the --dev option like this:

composer require reliese/laravel --dev

Add themodels.php configuration file to yourconfig directory and clear the config cache:

php artisan vendor:publish --tag=reliese-models# Let's refresh our config cache just in casephp artisan config:clear

Models

Generating models with artisan

Usage

Assuming you have already configured your database, you are now all set to go.

  • Let's scaffold some of your models from your default connection.
php artisan code:models
  • You can scaffold a specific table like this:
php artisan code:models --table=users
  • You can also specify the connection:
php artisan code:models --connection=mysql
  • If you are using a MySQL database, you can specify which schema you want to scaffold:
php artisan code:models --schema=shop

Customizing Model Scaffolding

To change the scaffolding behaviour you can makeconfig/models.php configuration filefit your database needs.Check it out ;-)

Tips

1. Keeping model changes

You may want to generate your models as often as you change your database. In ordernot to lose your own model changes, you should setbase_files totrue in yourconfig/models.php.

When you enable this feature your models will inherit their base configurations frombase models. You should avoid adding code to your base models, since youwill lose all changes when they are generated again.

Note: You will end up with two models for the same table and you may think it is a horrible ideato have two classes for the same thing. However, it is up to youto decide whether this approach gives value to your project :-)

Support

For the time being, this package supports MySQL, PostgreSQL and SQLite databases. Support for other databases are encouraged to be added through pull requests.

Packages

No packages published

Contributors36

Languages


[8]ページ先頭

©2009-2025 Movatter.jp