コード例 #1
0
 /**
  * @param string $uri
  * @return string
  */
 public function executeRoute($uri)
 {
     $method = $this->getRouter()->findRouteByUri($uri);
     if (strpos($method, '::') !== false) {
         Callback::invoke($method, [$this]);
     } else {
         $this->{$method}();
     }
     return $method;
 }
コード例 #2
0
ファイル: Filter.php プロジェクト: BlueCatTAT/kodicms-laravel
 /**
  *
  * @param string $field
  * @param mixed $value
  * @param array $rules
  * @return mixed
  */
 public function filterFieldValue($field, $value, array $rules = null)
 {
     if (empty($rules)) {
         $rules = array_get($this->rules, $field . '.rules', []);
     }
     // Bind the field name and model so they can be used in the filter method
     $_bound = [':field' => $field, ':filter' => $this];
     foreach ($rules as $filter) {
         // Value needs to be bound inside the loop so we are always using the
         // version that was modified by the filters that already ran
         $_bound[':value'] = $value;
         $params = [':value'];
         foreach ($params as $key => $param) {
             if (is_string($param) and array_key_exists($param, $_bound)) {
                 // Replace with bound value
                 $params[$key] = $_bound[$param];
             }
         }
         $value = Callback::invoke($filter, $params);
     }
     return $value;
 }