MyGit

reliese/laravel

Fork: 320 Star: 1510 (更新于 2024-12-20 08:59:20)

license: MIT

Language: PHP .

Reliese Laravel Model Generator

最后发布版本: v1.3.3 ( 2024-08-15 17:35:39)

GitHub网址

Reliese Laravel Model Generator

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Reliese Laravel Model Generator aims to speed up the development process of Laravel applications by providing some convenient code-generation capabilities. The tool inspects your database structure, including column names and foreign keys, in order to 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 the reliese/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 the models.php configuration file to your config directory and clear the config cache:

php artisan vendor:publish --tag=reliese-models

# Let's refresh our config cache just in case
php 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 make config/models.php configuration file fit 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 order not to lose your own model changes, you should set base_files to true in your config/models.php.

When you enable this feature your models will inherit their base configurations from base models. You should avoid adding code to your base models, since you will 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 idea to have two classes for the same thing. However, it is up to you to 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.

最近版本更新:(数据更新于 2024-09-02 21:54:29)

2024-08-15 17:35:39 v1.3.3

2024-06-06 22:30:33 v1.3.2

2024-05-10 19:57:50 v1.3.1

2024-04-12 22:03:13 v1.3.0

2023-12-04 21:29:27 v1.2.4

2023-08-17 15:52:46 v1.2.3

2023-04-04 19:49:34 v1.2.2

2023-03-11 00:11:29 v1.2.0

2022-10-14 17:06:56 v1.1.8

2022-08-22 18:17:46 v1.1.7

主题(topics):

database, eloquent, eloquent-models, laravel, laravel-components, mysql-database, scaffold

reliese/laravel同语言 PHP最近更新仓库

2024-12-13 19:38:03 coollabsio/coolify

2024-12-13 09:22:46 w7corp/easywechat

2024-12-11 20:15:22 symfony/symfony

2024-11-29 16:49:37 symfony/var-dumper

2024-11-20 23:58:25 laravel/framework

2024-11-20 18:39:23 danielmiessler/SecLists