first commit
This commit is contained in:
46
Modules/Order/app/Repositories/OrderRepository.php
Normal file
46
Modules/Order/app/Repositories/OrderRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user