我的代码存在问题:
public function show($id) {
$campaign = Campaign::where(function ($query) {
$query->where('Status', '=', 'yes')
->orWhere('AppUserId', '=', Auth::user()->AppUserId);
})->where(function ($query) {
$query->where('CampaignId', '=', $id);
})->get()->toArray();
}
我正在
未定义的变量:id
如何在函数内获取$ id变量值:
$query->where('CampaignId', '=', $id);
使用依赖注入而不是全局变量?
非常感谢任何帮助!