public function postPos() { $q = strtolower(Input::get('term')); if (!$q) { return; } $data['response'] = 'false'; $query = Pos::where('pos_id', 'LIKE', "%{$q}%")->orWhere('pos_description', 'LIKE', "%{$q}%")->get(); if ($query) { $data['message'] = array(); $data['response'] = 'true'; foreach ($query as $row) { $records = $row->pos_description . ' (' . $row->pos_id . ')'; $data['message'][] = array('label' => $records, 'value' => $row->pos_id); } } echo json_encode($data); }