【发布时间】:2021-03-18 18:48:40
【问题描述】:
尝试为支付脚本构建 API。但我想使用 API 按 $merchant_id 或 $reference number 显示。但是当我尝试使用 json 时,只返回 $id 这是主键。
如何让它显示为 $merchant_id 字符串?
这是 UserController 中的代码
public function show($merchant_key)
{
return Exttransfer::find($merchant_key);
}
以及App/Api中的代码
Route::get('Exttransfer/{$merchant_key}', 'UserController@show');
无论我做什么,它都只通过 $id 显示 Mercer_key 的一个例子是 ) OBGDTE36B2
【问题讨论】:
-
你能展示Exttransfer的模型吗?