多模块中的其他项

多模块调试

modules.php 配置文件中开启trace

    /*
    |--------------------------------------------------------------------------
    | 是否开启 Trace 页面调试
    |--------------------------------------------------------------------------
    |
    | 默认关闭
    |
    */
    'trace'                          => (bool)env('APP_TRACE', false),

代码调试

使用辅助函数 trace 进行调整,
// 支持任意个不同类型的参数
trace('this is a test string');
trace(['this is a test array1']);
trace('string',['array1'],['array2'],'string2');
说明: 如果是普通的get请求(非ajax请求),会直接在页面底部展示调试信息; 如果是其他请求的 会记录到 laravel 的本地日志文件中,以日志的方式呈现

 

预览

    public function test(Request $request)
    {
        trace('测试调试字符串', ['info'=>[
            '测试调试字符串111'
        ]]);
        try {
            DB::beginTransaction();
            AdminLog::query()->first();
            DB::commit();
            return '';
        } catch (\Exception $exception) {
            DB::rollback();
            return $this->error([
                'code'    => 500,
                'message' => $exception->getMessage(),
            ]);
        }
    }

打印调试数据
Trace Message

监听SQL
Trace SQL

路由信息
Trace Route