msazzuhair/laravel-artisan-destroy

这是我的包 laravel-artisan-destroy

v0.2.0 2024-03-12 14:35 UTC

This package is auto-updated.

Last update: 2024-09-08 06:17:17 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

⚠️⚠️ 不要在生产环境中安装此包。 ⚠️⚠️

为那些犹豫不决的人提供了一个(可能)缺失的 destroy 命令。这将删除项目中的 artisan 生成的文件。

比如说,您已经使用 artisan make 命令生成了一些文件。然后您想到了一个更好的名字,或者生成的文件没有根据 Laravel 命名约定得到合适的命名。这个简单的包将帮助您清理这些混乱。

只需将您的 artisan make:... 命令替换为 artisan destroy:... 即可。这些命令还会在您尝试删除的文件未跟踪或包含未提交更改时警告您。

我已经在我的项目中使用了一些这些命令,所以它们应该可以工作。

开发进度

可选要求

  • Git。此包将检查要删除的文件是否被跟踪且清洁。如果未安装 git,您需要使用 --force 选项或通过配置文件禁用 git 检查。

安装

您可以通过 composer 将此包作为开发依赖项安装

composer require --dev msazzuhair/laravel-artisan-destroy

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="laravel-artisan-destroy-config"

用法

php artisan destroy:model <Model Name>

您可以使用 artisan help 查看每个命令的所有可用选项。例如

php artisan help destroy:model
Description:
  Delete an Eloquent model class

Usage:
  destroy:model [options] [--] <name>

Arguments:
  name                  The name of the model

Options:
  -a, --all             Delete a migration, seeder, factory, policy, resource controller, and form request classes for the model
  -c, --controller      Delete a controller for the model
  -f, --factory         Delete a factory for the model
      --force           Delete the class without prompting for confirmation
  -m, --migration       Delete a migration file for the model
      --policy          Delete a policy for the model
  -s, --seed            Delete a seeder for the model
  -R, --requests        Delete new form request classes and use them in the resource controller
  -t, --test            Delete any accompanying PHPUnit test for the model and every related classes that is going to also be deleted
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

测试

composer test

变更日志

请参阅 变更日志 了解最近的变化信息。

贡献

请参阅 贡献指南 了解详细信息。

安全漏洞

请审查 我们的安全策略 了解如何报告安全漏洞。

致谢

许可证

MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件