/** * Create as we need to build the paper name if one doesnt exist. */ public function get() { $results = parent::get(); // we have the results, we now need to go through and build the names up for ($i = 0; $i < count($results); $i++) { if ($results[$i]['name'] == NULL) { $collection = orm::factory('collection')->find($results[$i]['collection_id']); $results[$i]['name'] = $collection->paper->name . ' ' . $collection->finish->name . ' ' . ucwords($results[$i]['color']); } } return $results; }
/** * Used to return the results from the search as an ajax request. * @todo add check to make sure that the paper is 'approved' */ public function query() { $papers = Search_Name::search('tips', $this->input->get()); echo json_encode($papers); die; }