laravolt/thunderclap

Laravel CRUD 生成器

v4.0.2 2020-02-21 01:34 UTC

This package is auto-updated.

Last update: 2024-09-21 19:58:22 UTC


README

Laravel CRUD 生成器,特别适用于 Laravolt 平台。

安装

通过 composer 安装 thunderclap

composer require laravolt/thunderclap

添加服务提供者(仅限 Laravel <= 5.4)

Laravolt\Thunderclap\ServiceProvider::class,

警告! Thunderclap 假设以下包已安装在你的应用程序中

{
	"nwidart/laravel-modules": "^5.0",
	"sofa/eloquence": "^5.6"
}

配置

发布配置文件 php artisan vendor:publish --provider='Laravolt\Thunderclap\ServiceProvider' --tag=config,将生成 config/laravolt/thunderclap.php 文件和其中示例代码。

<?php

return [
    // specify columns that you want to except
    'columns' => [
        'except' => ['id', 'created_at', 'updated_at', 'deleted_at', 'remember_token']
    ],
    'view' => [
        'extends' => 'layout'
    ],
    // custom your routes specification
    'routes'     => [
        'prefix'    => '',
        'middleware' => [],
    ],
    // custom your namespace per module
    'namespace'  => 'Modules',
    'target_dir' => base_path('modules'),
    
    // Template skeleton (stubs)
    'default'    => 'laravolt',

    // name => directory path, relative with stubs directory or absolute path
    'templates'  => [
        'laravolt' => 'laravolt',
    ],    
];

用法

  1. 运行命令并选择你的表
php artisan laravolt:clap

👏 双击你的手,然后跟随魔法...

  1. 将你的模块注册到 composer.jsonconfig/app.php 中,例如你的表名是 category
    • composer.json
       "autoload": {
       	"psr-4": {
       		"App\\": "app/",
       		"Modules\\": "modules" <= insert here
       	},
       	....
       },
       ....
      
    • config/app.php
       'providers' => [
       	....
       	 /*
           * Package Service Providers...
           */
           
           Modules\Category\Providers\ServiceProvider::class,
               
          /*
           * Application Service Providers...
           */
          ....
       ]
      
      
  2. 运行 composer dumpautoload

路线图

  • 基于数据库的生成器
  • 基于 JSON 文件的生成器
  • 关系
  • 字段类型
    • 文本
    • 多行文本框
    • 下拉列表
    • 复选框
    • 日期
    • 日期时间
  • 表格
    • 批量删除
    • 删除确认
  • 表单
    • 行内错误信息
    • 标记必填字段
  • 自定义模板
  • API 生成器
  • API 文档