PHP code example of songbai / laravel-builder

1. Go to this page and download the library: Download songbai/laravel-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

songbai / laravel-builder example snippets


php artisan lb // 选择使用功能
php artisan lb:request // 验证器
php artisan lb:t2m //已有表格生成模型
php artisan lb:controller // 生成控制器
php artisan lb:getColumn {name?} //  获取字段信息
php artisan lb:CreateDicFile // 创建字典文件

// 发布配置
php artisan vendor:publish --provider="SongBai\LaravelBuilder\Providers\LaravelBuilderServiceProvider"

// 将需要自定义的模板复制一份 stub-path 指定的目录

return [
    'stub-path' => resource_path('stub')
];

      'STATUS' => 
      array (
        0 => 
        array (
          'value' => 0,
          'label' => '未执行',
        ),
        1 => 
        array (
          'value' => 10,
          'label' => '待执行',
        ),
        2 => 
        array (
          'value' => 20,
          'label' => '执行成功',
        ),
        3 => 
        array (
          'value' => -10,
          'label' => '执行失败',
        ),
bash
php artisan make:model user -m
bash
php artisan lb // 根据提示 填写模块名 不用加controller

php artisan lb:request user users // 生成验证规则文件,参数1 模块名 参数2 表名
// 以上将根据字段类型 为store,update 方法生成默认的验证规则。
// 控制器如有其他方法需要验证,新增一个 方法名+Rule的方法即可。