30 lines
542 B
PHP
30 lines
542 B
PHP
<?php
|
|
|
|
namespace App\Repositories\Shop;
|
|
|
|
use App\Models\Shop\OrderDetail;
|
|
use App\Traits\Model\Basic;
|
|
|
|
class OrderDetails
|
|
{
|
|
use Basic;
|
|
|
|
public static function saveBasket($order_id, $data)
|
|
{
|
|
foreach ($data as $item) {
|
|
$item['order_id'] = $order_id;
|
|
$detail = self::store($item);
|
|
if ($detail) {
|
|
OfferStocks::decreaseStock($item);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static function getModel()
|
|
{
|
|
return OrderDetail::query();
|
|
}
|
|
}
|