update
This commit is contained in:
@@ -3,43 +3,18 @@
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\InvoicePayment;
|
||||
use App\Traits\Model\Basic;
|
||||
|
||||
class InvoicePayments
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public static function init()
|
||||
{
|
||||
return [
|
||||
'payment_types' => self::paymentTypes(),
|
||||
];
|
||||
}
|
||||
public static function get($id, $relations = false)
|
||||
{
|
||||
return $relations ? InvoicePayment::with($relations)->findOrFail($id) : InvoicePayment::findOrFail($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
return ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return InvoicePayment::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 delete($id)
|
||||
{
|
||||
return InvoicePayment::destroy($id);
|
||||
}
|
||||
|
||||
public static function getPaymentType($id)
|
||||
{
|
||||
@@ -55,4 +30,9 @@ class InvoicePayments
|
||||
'VIREMENT',
|
||||
];
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return InvoicePayment::query();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class Invoices
|
||||
|
||||
public static function getFull($id)
|
||||
{
|
||||
return self::get($id, ['address', 'order.customer', 'order.delivery_address', 'order.detail']);
|
||||
return self::get($id, ['address', 'payments', 'order.customer', 'order.delivery_address', 'order.detail']);
|
||||
}
|
||||
|
||||
public static function getByUUID($uuid)
|
||||
|
||||
Reference in New Issue
Block a user