三亩地 三亩地SAN MU DI · CODE DIARY
ARTICLE DETAIL

日记详情

真实记录编程学习的某一天,欢迎挑你感兴趣的翻一翻。

laravel框架控制器在接口输出数据中最外层添加字段重置response.data数据success

laravel框架控制器在接口输出数据中最外层添加字段重置response.data数据success

laravel框架控制器在接口输出数据中最外层添加字段

public function index($request) { $result = $this->testAppService->getAll($request); $response = $this->success($result)->respond(); $responseData = $response->getData(); // 添加 can_edit 字段 $responseData->can_edit = $this->checkCanEditPermission(); return response()->json($responseData, 200, [], JSON_UNESCAPED_UNICODE); }
← 返回列表