espero-soft/artisan

Laravel 命令行界面 (CLI)

dev-main 2023-12-28 10:03 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:18:53 UTC


README

这是一个用于生成实体、CRUD、服务操作的 Laravel 项目的包。

安装

运行以下命令安装包

composer require espero-soft/artisan:dev-main

更新 app/Console/kernel.php 文件中的 commands 方法

/**
 * Register the commands for the application.
 */
protected function commands(): void
{
    $this->load(__DIR__.'/Commands');

    // Registering the MakeEntityCommand as a ClosureCommand
    $this->getArtisan()->add( new MakeEntityCommand() );
    // Registering the MakeCrudCommand as a ClosureCommand
    $this->getArtisan()->add( new MakeCrudCommand() );
    // Registering the MakeServiceCommand as a ClosureCommand
    $this->getArtisan()->add( new MakeServiceCommand() );

    require base_path('routes/console.php');
}

用法

生成实体

要生成新的实体,请使用以下命令

php artisan make:entity YourEntityName

生成 CRUD

要为现有实体创建完整的 CRUD,请使用以下命令

php artisan make:crud YourEntityName

示例

以下是一些用法示例

php artisan make:entity Post
php artisan make:crud Post

贡献

所有贡献都受到欢迎!如果您想改进此包,请提出问题以讨论拟议的更改。

作者

Espero-Soft Informatiques

许可

此包处于 MIT 许可之下。有关详细信息,请参阅 LICENSE 文件。