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:
how should I modify it?