ahnaf/crud-generator

dev-main 2023-05-17 10:11 UTC

This package is auto-updated.

Last update: 2024-09-17 13:17:10 UTC


README

这个 Laravel 生成器包提供并生成控制器、模型(包含 Eloquent 关系)和视图,用于通过单条命令开发您的应用程序,支持 Bootstrap。

  • 将创建具有 Eloquent 关系的 模型
  • 将创建包含所有资源的 控制器
  • 将在 Bootstrap 中创建 视图
  • 它还将处理外键约束,并在 CRUD 表单中显示外键字段的选择输入

要求

Laravel >= 5.5
PHP >= 7.1
Mysql

安装

1 - 安装

composer require ahnaf/crud-generator --dev

2- 发布默认包的配置

php artisan vendor:publish --tag=crud

用法

php artisan make:crud {table_name}

php artisan make:crud employees

web.php 中添加路由

Route::resource('employees', 'EmployeeController');

路由名称使用复数缩写形式。

选项

  • 自定义路由
php artisan make:crud {table_name} --route={route_name}