PHP code example of yantico / laravel-dev

1. Go to this page and download the library: Download yantico/laravel-dev 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/ */

    

yantico / laravel-dev example snippets


return [
    'showDoc' => env('SHOW_DOC', true),  // 生产环境建议设为 false
    'perPageAllow' => [10, 20, 50, 100],
];

return [
    // ===== 分页 =====
    // 允许的分页大小,用于 Builder 宏 page() 和 ControllerTrait::perPage()
    'perPageAllow' => [10, 20, 50, 100],

    // ===== 数据库备份 =====
    // php artisan db:backup 会把这些表的数据导出为 Seed 文件
    'dbBackupList' => [
        'sys_permissions',
        'sys_roles',
        'personal_access_tokens',
    ],

    // ===== Migration 重命名 =====
    // php artisan Rename 时跳过匹配这些模式的文件
    'migrationBlacklists' => [],

    // ===== Model 生成 =====
    // gam 命令跳过这些表(不生成 Model)
    'dbSkipGenModel' => ['cache', 'sessions', 'jobs', 'failed_jobs'],

    // 自动为这些表的 Model 添加 HasApiTokens trait
    'hasApiTokens' => ['admins', 'wechats'],

    // 自动为这些表的 Model 添加 HasRoles trait
    'hasRoles' => ['sys_permissions', 'sys_roles'],

    // 自动为这些表的 Model 添加 Kalnoy\NodeTrait(嵌套集合/树形结构)
    'hasNodeTrait' => ['categories'],

    // ===== 在线文档 =====
    // 是否注册文档路由(/api/docs/openapi、/api/docs/plantuml)
    'showDoc' => env('SHOW_DOC', true),

    // ===== 权限校验 =====
    // 这些模块下的接口会启用 CheckPermissionMiddleware
    'enableCheckPermissionModules' => ['Admin'],

    // ===== ER 图 =====
    // PlantUML 渲染服务器地址
    'plantUmlServer' => 'https://www.plantuml.com/plantuml/svg/',

    // ER 图分组(每组包含一组相关联的表)
    'erMaps' => [
        '用户体系' => ['users', 'user_profiles', 'user_logs'],
        '订单系统' => ['orders', 'order_items', 'products'],
    ],
];
bash
php artisan vendor:publish --tag=laravel-dev

config/project.php     ← 包配置文件(可自定义)
public/docs/            ← API 在线文档前端页面
bash
php artisan cdb    # 缓存数据库表结构(本地环境会自动刷新,无需重复执行)
bash
# 为 users 表生成 Model(Base + 可编辑类)
php artisan gd users

# 生成 Controller(放在 Admin 模块下)
php artisan gc Admin/Users

# 生成 Enum(如 users 表有个 type 字段)
php artisan ge users/type