我得到一個包含匹配變量的隱藏字段。Laravel從輸入數組中檢索元素
{{ Form::input('hidden', 'match', $match, ['id' => 'match']) }}
如何在我的商店方法中檢索「主頁」字段等?
public function store(Request $request)
{
Log::info($request->match);
Ticket::create([
'home' => $request->match->home,
'away' => $request->away,
'place' => $request->place,
'price' => $request->price,
'section' => $request->section,
'amount' => $request->amount,
'competition' => $request->competition
]);
return redirect('/');
}
能否請您向我們展示'Log :: info($ request-> match);'?它是一個對象嗎?陣列? –
我假設你將匹配id存儲在隱藏字段中,只需在你的控制器中用Match :: find($ request-> match)查詢它; – btl