47 lines
865 B
PHP
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');
|
|
}
|
|
|
|
}
|