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

@@ -3,9 +3,12 @@
namespace App\Repositories\Shop;
use App\Models\Shop\SaleChannel;
use App\Traits\Model\Basic;
class SaleChannels
{
use Basic;
public static function getDefaultID()
{
$default = self::getDefault();
@@ -23,45 +26,8 @@ class SaleChannels
return SaleChannel::byCode($code)->first();
}
public static function getOptions()
public static function getModel()
{
return SaleChannel::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
}
public static function getAll()
{
return SaleChannel::orderBy('name', 'asc')->get();
}
public static function get($id)
{
return SaleChannel::findOrFail($id);
}
public static function store($data)
{
$id = isset($data['id']) ? $data['id'] : false;
$item = $id ? self::update($data) : self::create($data);
return $item->id;
}
public static function create($data)
{
return SaleChannel::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 SaleChannel::destroy($id);
return SaleChannel::query();
}
}