uipps/generate-models-4-packagist

Auto generate models base on Laravel functions.

v5.2.1 2022-04-02 05:09 UTC

README

auto generate models and controllers for each table base on laravel function.

How does it work?

This package expects that you are using Laravel 5.1 or above. You will need to import the uipps/generate-models-4-packagist package via composer:

Configuration

composer require uipps/generate-models-4-packagist

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 generate:models

php artisan generate:models --cast=1 --event=1 --observer=1 --scope=1

// full params
php artisan generate:models -c "mysql://root:101010@127.0.0.1:3511" -d laravel_dev -t project -p Uipps/Admin --cast=1 -e 1 -o 1 -s 1
  • You can scaffold a specific table like this:
php artisan generate:models --table=users
  • You can also specify the connection:
php artisan generate:models --connection=mysql
php artisan generate:models -c mysql

// dsn connection
php artisan generate:models -c "mysql://root:101010@127.0.0.1:3511/laravel_dev"
  • If you are using a MySQL database, you can specify which database you want to scaffold:
php artisan generate:models --database=shop
  • other params
php artisan generate:models --table=Country --path_relative=Uipps/Admin
means:
php artisan make:controller Uipps/Admin/CountryController --model=Uipps/Admin/Country


// make cast,event,observer,scope
php artisan generate:models -p Uipps/ --cast=1 --event=1 --observer=1 --scope=1
or:
php artisan generate:models -p Uipps/ --cast=1 -e 1 -o 1 -s 1

  • make controller
php artisan generate:models -t Country -p Uipps/Admin
means:
php artisan make:controller uipps/Admin/CountryController --model=uipps/Admin/Country

Support

For the time being, this package supports MySQL only. PostgreSQL and SQLite databases will be Supported in future.