40 lines
790 B
PHP
40 lines
790 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Interfaces\OrderRepositoryInterface;
|
|
use App\Models\Order;
|
|
|
|
class OrderRepository implements OrderRepositoryInterface
|
|
{
|
|
public function getAllOrders()
|
|
{
|
|
return Order::all();
|
|
}
|
|
|
|
public function getOrderById($orderId)
|
|
{
|
|
return Order::findOrFail($orderId);
|
|
}
|
|
|
|
public function deleteOrder($orderId)
|
|
{
|
|
Order::destroy($orderId);
|
|
}
|
|
|
|
public function createOrder(array $orderDetails)
|
|
{
|
|
return Order::create($orderDetails);
|
|
}
|
|
|
|
public function updateOrder($orderId, array $newDetails)
|
|
{
|
|
return Order::whereId($orderId)->update($newDetails);
|
|
}
|
|
|
|
public function getFulfilledOrders()
|
|
{
|
|
return Order::where('is_fulfilled', true);
|
|
}
|
|
}
|