How is code and message configured in the return body of the API interface written by laravel+dingo/api?

the following is the controller of the API interface I wrote:

<?php

namespace App\Http\Controllers\Lucky;

use Illuminate\Http\Request;
use App\Http\Controllers\BaseController as BaseController;
use App\Models\Card;
use App\Http\Transformers\CardsTransformer;

class CardsController extends BaseController
{
    public function test(Request $request) {
        $unionId = $request->input("unionId");
        $card = new Card;
        $card->union_id = $unionId;
        $card->fi_card = 1;
        $card->s_card = 2;
        $card->t_card = 3;
        $card->fo_card = 4;
        $card->save();
        return $this->response->item($card, new CardsTransformer());
    }
}

write like this. The return body obtained by calling this API is as follows:

{
    "data": {
        "unionId": "test",
        "fiCard": 1,
        "sCard": 2,
        "tCard": 3,
        "foCard": 4
    }
}

but I think the correct return body of the API interface should be as follows:

{
    code:0,
    message:"ok",
    data:{},
    useTime:0.017374038696289062
}

how do I configure code and message fields for the return body of each interface in the technology stack of laravel and dingo/api? And its corresponding content?

Jun.16,2022

you can refer to https://learnku.com/laravel/t...
Welcome Correction

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ed4d59-47f7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ed4d59-47f7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?