StocksNew/Modules/Order/app/Repositories/OrderRepository.php

47 lines
865 B
PHP
Raw Permalink Normal View History

2024-08-27 12:03:06 +00:00
<?php
namespace Modules\Order\Repositories;
use Modules\Order\Models\Order;
class OrderRepository implements OrderInterface
{
public function findAll()
{
return Order::when(true, function ($query) {
})->paginate(20);
}
public function getOrderById($OrderId)
{
return Order::findOrFail($OrderId);
}
public function getOrderByEmail($email)
{
return Order::where('email', $email)->first();
}
public function delete($OrderId)
{
Order::destroy($OrderId);
}
public function create($OrderDetails)
{
return Order::create($OrderDetails);
}
public function update($OrderId, array $newDetails)
{
return Order::whereId($OrderId)->update($newDetails);
}
public function pluck()
{
return Order::pluck('name', 'id');
}
}