Dingo api $response 未定义

Dingo api $response is undefined

获取错误

"message": "Undefined property: App\Http\Controllers\Api\ApiUserXYzController::$response"

return $this->response->collection($user_list, new ProjectTransformer())->setStatusCode(200);

我正在尝试转换数据,但我得到 $response is not defined。请指导

如果您希望控制器上的 属性 response 处的响应生成器,您忘记了包含文档告诉您 use 的辅助特性。

Dingo Wiki - Responses - Response Builder

use Dingo\Api\Routing\Helpers;

class SomeController ....
{
    use Helpers;
    ...
}