rhaarhoff / laravel-artisan-commands

提供生成服务、仓库等的有用Artisan命令。

v1.1.2 2019-05-27 07:22 UTC

This package is auto-updated.

Last update: 2024-09-27 20:30:45 UTC


README

Latest Stable Version Software License Total Stars Total Downloads

描述

此包提供了一些用于生成服务、仓库等的有用Artisan命令。

安装

使用以下命令通过Composer安装此包:

composer require rhaarhoff/laravel-artisan-commands

更新Composer后,将服务提供者添加到config/app.php文件中的providers数组中

Rhaarhoff\LaravelArtisanCommands\CommandServiceProvider::class

运行dump-autoload命令

composer dump-autoload

在Laravel中,您可以在app/Providers/AppServiceProvider.php文件中的register()方法中添加以下代码,而不是在config/app.php文件中添加服务提供者:

public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Rhaarhoff\LaravelArtisanCommands\CommandServiceProvider::class);
    }
    // ...
}

命令

以下是可以使用的所有命令,包括可以指定的参数。

COMMAND                     PARAMETER             DESCRIPTION
-----------------------------------------------------------------------------------------------------------------------
make:service <name>                               Generates a basic service class
make:service <name>         -m <model>            Generates a basic service class as well as a model
make:service <name>         -c                    Generates a service class with a constructor
make:service <name>         -y <repository>       Generates a service class as well as a repository
make:repository <name>                            Generates a basic repository class
make:repository <name>      -m <model>            Generates a repository class as well as a model
make:layer <name>                                 Generates only a model class if no parameters are specified
make:layer <name>           -c                    Generates a new controller class for the model
make:layer <name>           -s                    Generates a new service class for the model
make:layer <name>           -y                    Generates a new repository class for the model
make:layer <name>           -f                    Generates a new factory class for the model
make:layer <name>           -m                    Generates a new migration for the model
make:layer <name>           -p                    Indicates if the model should be a custom intermediate table model
make:layer <name>           -r                    Indicates if the generated controller should be a resource controller
make:layer <name>           -all                  Generates a migration, factory, resource controller, service
                                                  and repository for the model

许可证

Laravel Artisan Commands 是开源软件,许可协议为MIT许可证