Пример #1
0
 /**
  * Check if there is any sql operator in the string
  * filter, if there is, then remove it from the string
  * and return which operator is was
  *
  * @param $string
  * @return array
  */
 public static function findOperationWhere($string)
 {
     $operations = [">=", "<=", ">", "<", "!=", "<>"];
     foreach ($operations as $operation) {
         if (Str::startsWith($string, $operation)) {
             return ['operation' => $operation, 'text' => String::remove($string, $operation)];
         }
     }
     if (Str::contains($string, "%")) {
         return ['operation' => "LIKE", 'text' => $string];
     }
     return ['operation' => "=", 'text' => $string];
 }
Пример #2
0
 public static function build($columnName, $overrides, $defaultProperties)
 {
     $field = Factory::createField($columnName, Vector::findOrEmpty($overrides, 'type'));
     return collect(['align' => 'left', 'label' => String::labelize($columnName), 'width' => null, 'order' => $defaultProperties['order'], 'filter' => $defaultProperties['filter'], 'name' => $columnName])->merge($overrides)->merge(['type' => $field])->toArray();
 }
Пример #3
0
 /**
  * Set the field attributes
  *
  * @param array $attributes
  * @return null
  */
 private function setAttributes($fieldName, array $attributes)
 {
     $this->attributes = array_merge($this->attributes, ['label' => String::labelize($fieldName), 'name' => $fieldName, 'hidden' => false, 'disabled' => false, 'readonly' => false, 'required' => true, 'value' => null], $attributes);
 }