better management of shipping and basket summary display
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user