Laravel uses dingo/api to transform Times Undefined variable to data?

the controller code is as follows:

<?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 show(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();
        $a = new CardsTransformer();
        $b = $a->transform($card);

        return $this->response->array(["code"=>0,"msg"=>"OK","data"=>$b]);
    }
}

the transformer code is as follows:

<?php

namespace App\Http\Transformers;

use League\Fractal\TransformerAbstract;
use App\Models\Card;

class CardsTransformer extends TransformerAbstract
{
    public function transform(Card $Card) {
        return [
            "unionId" => $card["union_id"],
            "fiCard" => $card["fi_card"],
            "sCard" => $card["s_card"],
            "tCard" => $card["t_card"],
            "foCard" => $card["fo_card"]
        ];
    }
}

the error is as follows:

clipboard.png

how should I modify it?

Apr.25,2022

Thank you for the invitation,
$Card change to $card

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-1e39d87-64b82.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-1e39d87-64b82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?