本文整理汇总了PHP中app\models\Invoice::buildQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::buildQuery方法的具体用法?PHP Invoice::buildQuery怎么用?PHP Invoice::buildQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Invoice
的用法示例。
在下文中一共展示了Invoice::buildQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
try {
$admin = \Auth::User();
if (!$admin) {
return $this->failResponse('admin not logged in');
}
$invoiceObj = new Invoice();
$query = $invoiceObj->buildQuery();
$total = $query->count();
$paginate = 1;
$meta = array();
if ($paginate == 0) {
$query = $query->with("Customer")->get();
$senddata = $query;
} else {
$limit = 10;
$offset = 0;
if (isset($_GET["limit"])) {
$limit = $_GET["limit"];
}
if (isset($_GET["offset"])) {
$offset = $_GET["offset"];
}
$perpage = $limit;
$query = $query->with("Customer")->paginate($perpage);
$data = $query->toArray();
$senddata = $data['data'];
$meta["total"] = $total;
$meta["offset"] = $offset;
$meta["limit"] = $limit;
}
return $this->successResponse($senddata, $meta);
} catch (\Exception $e) {
Log::error("error i customer controller");
return $this->failResponse($e->getMessage());
}
}