1
是否有可能更新多個模型是這樣的:laravel 4.2更新多個型號
$value = $model->collection;
if(count($value))
{
$prices = $collection->prices()->update(['price' => 'price' * 5]);
}
?或者我需要做這樣的事情:
if(count($value))
{
$prices = $collection->prices;
foreach($prices as $price) {
$price->price = $price->price * 5;
$price->save();
}
}