ahmedash95/ecrud

简单的 Laravel CRUD 生成器

0.1 2016-05-16 11:32 UTC

This package is auto-updated.

Last update: 2024-09-04 12:12:58 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

有时作为一个后端开发者,你可能会浪费很多时间编写小型表格或大型表格的 HTML 输入。所以这个包可以通过几个命令为你创建(索引、创建、更新)视图文件。

首先,你需要知道这个包是从你的 迁移 中生成 CRUD 文件的。

安装

首先通过 Composer 安装该包。在你的终端运行以下命令:

$ composer require ahmedash95/ecrud

完成后,将以下行添加到 config/app.php 文件中的 providers 数组中

Ahmedash95\Ecrud\EcrudServiceProvider::class,

此包只有一个配置文件

$ php artisan vendor:publish --provider="Ahmedash95\Ecrud\EcrudServiceProvider"

用法

从迁移创建 CRUD 文件

$ php artisan ecrud:migration 2016_04_17_144447_create_categories_table

如果文件已存在,除非你强制覆盖选项,否则包不会覆盖它们。

$ php artisan ecrud:migration 2016_04_17_144447_create_categories_table --force

此包会尝试猜测你在视图中需要的字段,例如,在从迁移文件加载字段时会移除 id 和时间戳,所以如果你需要排除某些字段或为特定字段生成 CRUD,你可以使用两个选项 only | except

$ php artisan ecrud:migration 2016_04_17_144447_create_categories_table --only=name,description 

排除

$ php artisan ecrud:migration 2016_04_17_144447_create_categories_table --except=user_id 

任何生成的 ecrud 的默认路径是视图路径 resources/views,所以如果你发布 create_categories_table,ecrud 路径将是 resources/views/categories。如果你想将路径更改为 resources/views/panel/categories,你必须使用选项 path

$ php artisan ecrud:migration 2016_04_17_144447_create_categories_table --force --path=panel/categories

贡献

  • 分支它
  • 创建你的功能分支(git checkout -b my-new-feature)
  • 提交你的更改(git commit -am '添加一些功能')
  • 推送到分支(git push origin my-new-feature)
  • 创建新的 Pull Request