irsyadulibad/ci4-datatables

How to write 'OR' keyword ?

manabroyown opened this issue · 3 comments

return DataTables::use('rpp_users')
->where(['rpp_users.role' => '3'])
->select('rpp_users.name as name,
rpp_users.uid as uid,
rpp_users.created_at as trial_at,
rpp_users.paid_at as paid_at,
rpp_users.expirydate as churned_at')
-> orWhere()
->make(true);

Please let me that how can use orWhere ?

File name: DataTableMethods.php
Line number: 34
Function:
public function where(Array $data)
{
$this->builder->where($data);
return $this;
}

I changed it to:

public function where($data)
{
$this->builder->where($data);
return $this;
}

File name: DataTableMethods.php
Line number: 34
Function:
public function where(Array $data)
{
$this->builder->where($data);
return $this;
}

I changed it to:

public function where($data)
{
$this->builder->where($data);
return $this;
}

and it works

$whereSql = "(rpp_users.created_at >= '$start_date' AND rpp_users.created_at <= '$end_date') OR (rpp_users.paid_at >= '$start_date' AND rpp_users.paid_at <= '$end_date') OR (rpp_users.expirydate >= '$start_date' AND rpp_users.expirydate <= '$end_date')";
$data_table = $data_table->where($whereSql)