public function removeService() { $data = Input::get(); $serv = Service::find($data['id']); $limit = Limit::where('service_id', '=', $serv->id)->delete(); $endpoints = EndPoint::where('service_id', '=', $serv->id)->delete(); $serv->delete(); return Response::json(array("success" => true, 'message' => 'Successfully removed service!')); }
/** * @example database::Query::limit * @code * <?php * # cria objeto de consulta * $query = Query::factory(...); * * # coluna que sera agrupada * $query->limit(10, 0); * ?> * @endcode * * {@ineritdoc} * */ public function limit($limit, $offset) { if (NULL == $this->_limit) { $this->_limit = LimitAbstract::factory($this->_driver); $this->_select->limit($this->_limit); } $this->_limit->set($limit, $offset); return $this; }
/** * Get limit from database for specified date. * * @param null|string $date date from which limit will be obtained, leave null for current day. * * @return double daily limit. */ function operations_ledcoin_daily_limit($date = NULL) { if ($date === NULL) { $date = date('Y-m-d'); } else { if (!preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/', $date)) { return 0.0; } list($year, $month, $day) = explode('-', $date); if (!checkdate($month, $day, $year)) { return 0.0; } } $limit = new Limit(); $limit->get_where(array('date' => $date)); if ($limit->exists()) { return (double) $limit->daily_limit; } return 0.0; }
private static function getServiceResult($text) { $services = Service::all(); $endpointsResult = array(); foreach ($services as $service) { $call_no = 0; $endpoints = $service->endpoints()->get(); foreach ($endpoints as $ep) { array_push($endpointsResult, $ep->call($text)); $call_no++; } $limit = Limit::where('service_id', '=', $service->id)->first(); $limit->current_hits = $limit->current_hits + $call_no; $limit->save(); } return $endpointsResult; }
public function limit_check($value, $type) { require_once 'Limit.php'; return Limit::check($value, $type); }
public function with_limits(Limit $limit) { $this->limit = $limit->query(); }
public function setFromParams(array $params = array()) { return parent::setFromParams(array_reverse($params)); }
public function __construct($limit = 10000, $quota = 10240, $current = 0) { parent::__construct($limit, $quota, $current, 'inode'); }
public function delete_limit($limit_id = null) { if (is_null($limit_id)) { add_error_flash_message('Denný limit sa nenašiel.'); redirect(site_url('limits')); } $this->db->trans_begin(); $limit = new Limit(); $limit->get_by_id((int) $limit_id); if (!$limit->exists()) { $this->db->trans_rollback(); add_error_flash_message('Denný limit sa nenašiel.'); redirect(site_url('limits')); } if (date('Y-m-d') > $limit->date) { $this->db->trans_rollback(); add_error_flash_message('Nie je povolené vymazávať staršie limity ako dnešné.'); redirect(site_url('limits')); } $date = date('d. m. Y', strtotime($limit->date)); $daily_limit = $limit->daily_limit; if ($limit->delete() && $this->db->trans_status()) { $this->db->trans_commit(); add_success_flash_message('Limit s dátumom <strong>' . $date . '</strong> a hodnotou <strong>' . $daily_limit . '</strong> bol úspešne vymazaný.'); } else { $this->db->trans_rollback(); add_error_flash_message('Nepodarilo sa vymazať limit s dátumom <strong>' . $date . '</strong> a hodnotou <strong>' . $daily_limit . '</strong>!'); } redirect(site_url('limits')); }