feat: Implement order and invoice management, enhance addon features, and remove the 'Type' module.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Api\Order;
|
||||
|
||||
use App\Models\Order;
|
||||
use App\Repositories\Api\BaseApiRepository;
|
||||
|
||||
class OrderRepository extends BaseApiRepository implements OrderRepositoryInterface
|
||||
{
|
||||
public function getModel()
|
||||
{
|
||||
return Order::class;
|
||||
}
|
||||
|
||||
public function createItem($orderId, array $data)
|
||||
{
|
||||
return \App\Models\OrderItem::create(array_merge(
|
||||
['order_id' => $orderId],
|
||||
$data
|
||||
));
|
||||
}
|
||||
|
||||
public function processPayment($order, $method)
|
||||
{
|
||||
return $order->update([
|
||||
'status' => 'paid',
|
||||
'payment_method' => $method,
|
||||
'paid_at' => now()
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user