本文整理汇总了PHP中Discount::skip方法的典型用法代码示例。如果您正苦于以下问题:PHP Discount::skip方法的具体用法?PHP Discount::skip怎么用?PHP Discount::skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discount
的用法示例。
在下文中一共展示了Discount::skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxDiscounts
public function ajaxDiscounts()
{
$i = Input::all();
$arr = [];
$arr = getallheaders();
$count = null;
if (isset($arr['Range'])) {
$response_array = array();
$range = $arr['Range'];
$response_array['Accept-Ranges'] = 'items';
$response_array['Range-Unit'] = 'items';
$arr = explode('-', $arr['Range']);
$items = $arr[1] - $arr[0] + 1;
$skip = $arr[0];
$skip = $skip < 0 ? 0 : $skip;
$c = null;
if (isset($_GET['query'])) {
$query = $_GET['query'];
if ($_GET['orderBy'] != '') {
$orderBy = $_GET['orderBy'];
$count = Discount::where('name', 'LIKE', "%{$query}%")->orWhere('code', 'LIKE', "%{$query}%")->get()->count();
$c = Discount::where('name', 'LIKE', "%{$query}%")->orWhere('code', 'LIKE', "%{$query}%")->orderBy("{$orderBy}", 'DESC')->skip($skip)->take($items)->get();
} else {
$count = Discount::where('name', 'LIKE', "%{$query}%")->orWhere('code', 'LIKE', "%{$query}%")->get()->count();
$c = Discount::where('name', 'LIKE', "%{$query}%")->orWhere('code', 'LIKE', "%{$query}%")->skip($skip)->take($items)->get();
}
} else {
$count = Discount::all()->count();
$c = Discount::skip($skip)->take($items)->get();
}
$response = Response::make($c, 200);
$response_array['Content-Ranges'] = 'items ' . $range . '/' . $count;
$response->header('Content-Range', $response_array['Content-Ranges'])->header('Accept-Ranges', 'items')->header('Range-Unit', 'items')->header('Total-Items', $count)->header('Flash-Message', 'Now showing pages ' . $arr[0] . '-' . $arr[1] . ' out of ' . $count);
return $response;
}
$c = Customer::all();
$response = Response::make($c, 200);
$response->header('Content-Ranges', 'test');
return $response;
}