Skip to content

Instantly share code, notes, and snippets.

@zabaala
Created February 17, 2018 00:54
Show Gist options
  • Save zabaala/d40f289652e64c999e110496980c4bf8 to your computer and use it in GitHub Desktop.
Save zabaala/d40f289652e64c999e110496980c4bf8 to your computer and use it in GitHub Desktop.
<?php
//...
class DbCouponRepository implements CouponRepositoryInterface
{
/**
* @const int
*/
const PAGE_SIZE = 25;
/**
* @var CouponEloquentModel
*/
private $model;
/**
* CouponRepository constructor.
*/
public function __construct()
{
$this->model = new CouponEloquentModel();
}
/**
* Get all coupons.
*
* @param null $filterableKeyword
* @param array $orders
* @return LengthAwarePaginator
*/
public function getAllCoupons(
$filterableKeyword = null,
array $orders = [
[
'column' => 'name',
'direction' => 'asc'
]
]
)
{
return (new FetchAllCouponsMethodObject(
$this->model,
$filterableKeyword,
$orders,
self::PAGE_SIZE)
)->handle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment