JoseLee214/laravel

Ypc ... 为 Laravel 框架生成代码的组件。由 Cristian Llanos 在 reliese/laravel 上 fork。

v0.0.26 2020-01-10 03:32 UTC

This package is auto-updated.

Last update: 2024-09-10 13:47:54 UTC


README

composer require joselee214/laravel

将服务提供者添加到您的 config/app.php 文件中的 providers

// ...
'providers' => [
    /*
     * Package Service Providers...
     */

    Joselee214\Ypc\Joselee214ServiceProvider::class,
],
// ...

仅本地环境配置

如果您只想为本地环境启用生成器,您应该使用 composer 通过 --dev 选项安装,如下所示

composer require joselee214/laravel --dev

然后您需要在 app/Providers/AppServiceProvider.php 文件中注册提供者。

public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register(\Joselee214\Ypc\Joselee214ServiceProvider::class);
    }
}

模型

Generating models with artisan

models.php 配置文件添加到您的 config 目录中,并清除配置缓存

php artisan vendor:publish --tag=Joselee214-models
php artisan config:clear

用法

假设您已经配置了数据库,现在您可以开始使用了。

  • 让我们根据您的默认连接创建一些模型。
php artisan zz:models
  • 您可以通过这种方式创建特定的表
php artisan zz:models --table=users
  • 您也可以指定连接
php artisan zz:models --connection=mysql
  • 如果您使用的是 MySQL 数据库,您可以指定您想要创建的架构
php artisan zz:models --schema=shop