add contact param
This commit is contained in:
parent
38bb2e04d3
commit
ba9e386b4d
@ -19,8 +19,11 @@ class Contact extends Controller {
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$ContactName = $this->request->getVar('ContactName');
|
||||
$Specialty = $this->request->getVar('Specialty');
|
||||
$model = new ContactModel();
|
||||
$rows = $model->getContacts();
|
||||
$rows = $model->getContacts($ContactName, $Specialty);
|
||||
//$rows = $model->getContacts();
|
||||
|
||||
if (empty($rows)) {
|
||||
return $this->respond([
|
||||
|
||||
@ -18,8 +18,11 @@ class ContactModel extends Model {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getContacts() {
|
||||
$rows = $this->select("ContactID, NameFirst, NameLast, Title, Initial, Specialty")->get()->getResultArray();
|
||||
public function getContacts($ContactName, $Specialty) {
|
||||
$sql = $this->select("ContactID, NameFirst, NameLast, Title, Initial, Specialty");
|
||||
if($ContactName !='') { $sql->like('NameFirst',$ContactName,'both')->orLike('NameLast',$ContactName,'both'); }
|
||||
if($Specialty != '') { $sql->like('Specialty',$Specialty); }
|
||||
$rows = $sql->get()->getResultArray();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user