StocksNew/Modules/Order/app/Repositories/OrderRepository.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

47 lines
865 B
PHP

<?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');
}
}