query improve
This commit is contained in:
@@ -55,19 +55,26 @@ class BkoReports extends BaseController
|
|||||||
// return $this->respond([], 200);
|
// return $this->respond([], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function applicationQuery($status): string{
|
||||||
|
return "
|
||||||
|
SELECT c.firstname, c.lastname, a.uid,a.loan_amount,
|
||||||
|
a.payment_month,a.sales_agent,a.gender,
|
||||||
|
a.marital_status,a.email,a.address,
|
||||||
|
a.state,a.country,a.status,a.added,
|
||||||
|
a.updated,
|
||||||
|
e.name AS employer_name
|
||||||
|
FROM applications a
|
||||||
|
LEFT JOIN customers c ON c.uid::text = a.customer_uid::text
|
||||||
|
LEFT JOIN employers e ON e.uid::text = a.employer_uid::text
|
||||||
|
WHERE a.status = $status
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
public function readyApplication() :ResponseInterface
|
public function readyApplication() :ResponseInterface
|
||||||
{
|
{
|
||||||
|
$readyQuery = $this->applicationQuery(2);
|
||||||
//SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications;
|
//SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications;
|
||||||
$query = $this->db->query("SELECT c.firstname, c.lastname, a.uid,a.loan_amount,
|
$query = $this->db->query("$readyQuery");
|
||||||
a.payment_month,a.sales_agent,a.gender,
|
|
||||||
a.marital_status,a.email,a.address,
|
|
||||||
a.state,a.country,a.status,a.added,
|
|
||||||
a.updated,
|
|
||||||
e.name AS employer_name
|
|
||||||
FROM applications a
|
|
||||||
LEFT JOIN customers c ON c.uid::text = a.customer_uid::text
|
|
||||||
LEFT JOIN employers e ON e.uid::text = a.employer_uid::text
|
|
||||||
WHERE a.status = 2 ");
|
|
||||||
$row = $query->getResult('array');
|
$row = $query->getResult('array');
|
||||||
$data = [
|
$data = [
|
||||||
'call_return' => '100',
|
'call_return' => '100',
|
||||||
|
|||||||
Reference in New Issue
Block a user