onepkg/laravel-crud-generator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

onepkg/laravel-crud-generator

最新稳定版本:v1.0.7

Composer 安装命令:

composer require onepkg/laravel-crud-generator

包简介

Laravel CRUD Generator

README 文档

README

Laravel CRUD Generator is a simple command line tool to generate CRUD operations for your models.

app/
├── Http/
│   ├── Controllers/
│   │   └── Api/
│   │       └── {Model}Controller.php  # RESTful controller
│   ├── Requests/
│   │       └── {Model}Request.php    # Form request
│   ├── Resources/
|   |       └── {Model}Collection.php   # JSON collection  
│   │       └── {Model}Resource.php   # JSON resource
├── Models/
│   └── {Model}.php                 # Model
└── Routes/
    └── api.php                     # API route

Usage

Install the package via composer:
composer require --dev onepkg/laravel-crud-generator
Run the command:
  • Generate CRUD files for the users table:
php artisan onepkg:make-crud User
  • If the table name is not in the plural form
php artisan onepkg:make-crud User --table=user
  • Specify the routing file
php artisan onepkg:make-crud User --route=api
Access the API
GET /api/users         # get listing
POST /api/users        # create
GET /api/users/{id}    # show detail
PUT /api/users/{id}    # update
DELETE /api/users/{id} # delete
Config
  • Publish the config file
php artisan vendor:publish --provider="Onepkg\LaravelCrudGenerator\LaravelCrudServiceProvider"
  • Modify the configuration

You can modify the configuration in /config/crud - generator.php

[
    'namespacedModel' => 'App\\Models',
    'namespacedRequest' => 'App\\Http\\Requests\\Admin',
    'namespacedResource' => 'App\\Http\\Resources\\Admin',
    'namespacedController' => 'App\\Http\\Controllers\\Admin',
]
Customize stubs

Publish the stubs

php artisan stub:publish

Modify the corresponding stubs in /stubs/*.

controller.crud.stub
model.crud.stub
request.crud.stub
resource-collection.crud.stub
resource.crud.stub
route.crud.stub

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-17