better management of shipping and basket summary display

This commit is contained in:
ludo
2023-12-03 00:40:47 +01:00
parent 4bcfc7bc6d
commit ec509df665
26 changed files with 317 additions and 477 deletions

View File

@@ -4,9 +4,12 @@ namespace App\Repositories\Shop;
use App\Models\Shop\Offer;
use App\Models\Shop\PriceListValue;
use App\Traits\Model\Basic;
class PriceListValues
{
use Basic;
public static function getPriceByOffer($offer_id, $quantity = 1, $sale_channel_id = false)
{
$prices = self::getPricesByOffer($offer_id, $sale_channel_id);
@@ -31,16 +34,6 @@ class PriceListValues
return PriceListValue::byPriceList($id)->get();
}
public static function getAll()
{
return PriceListValue::orderBy('name', 'asc')->get();
}
public static function get($id)
{
return PriceListValue::find($id);
}
public static function storePrices($price_list_id, $values)
{
foreach ($values as $value) {
@@ -51,30 +44,8 @@ class PriceListValues
}
}
public static function store($data)
public static function getModel()
{
$id = isset($data['id']) ? $data['id'] : false;
$price = $id ? self::update($data) : self::create($data);
return $price;
}
public static function create($data)
{
return PriceListValue::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}
public static function destroy($id)
{
return PriceListValue::destroy($id);
return PriceListValue::query();
}
}