【发布时间】:2016-08-17 11:12:02
【问题描述】:
我有这个存储方法:
public function store(Requests\OfferRequest $request)
{
$start = $request->input('from'); // 04/24/2016 12:00 AM
$end = $request->input('to); // 07/24/2016 12:00 AM
$auction = new Auction($request->all());
Auth::user()->auctions()->save($auction);
//how to get saved auction ID ?
}
现在我需要在 Offer 表中保存从 $start 到 $end 的每一天的空记录...只需将已保存拍卖的 id 放在 offer 表中的 auction_id 中...
我可以将其保存在一个查询中还是需要使用 for 循环?最好的方法是什么?
【问题讨论】:
标签: php laravel for-loop request store