asArray()); } } function listing($data = array()) { $listing = new Listing\Handler( \Model::factory('\MailPoet\Models\Segment'), $data ); wp_send_json($listing->get()); } function getAll() { $collection = Segment::find_array(); wp_send_json($collection); } function save($data = array()) { $result = Segment::createOrUpdate($data); if($result !== true) { wp_send_json($result); } else { wp_send_json(true); } } function update($args) { } function delete($id) { } }