add shipping rules
This commit is contained in:
44
app/Repositories/Shop/DeliveryPackages.php
Normal file
44
app/Repositories/Shop/DeliveryPackages.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\DeliveryPackage;
|
||||
|
||||
class DeliveryPackages
|
||||
{
|
||||
public static function getOptions()
|
||||
{
|
||||
return DeliveryPackage::pluck('name', 'id');
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return DeliveryPackage::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return DeliveryPackage::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 DeliveryPackage::destroy($id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user