本文整理匯總了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());
}
}