Maurits van der Schee 6 年之前
父節點
當前提交
3e142d4a0d
共有 1 個文件被更改,包括 10 次插入33 次删除
  1. 10
    33
      api.php

+ 10
- 33
api.php 查看文件

@@ -3237,30 +3237,6 @@ class FirewallMiddleware extends Middleware
3237 3237
     }
3238 3238
 }
3239 3239
 
3240
-// file: src/Tqdev/PhpCrudApi/Middleware/FormMiddleware.php
3241
-
3242
-class FormMiddleware extends Middleware
3243
-{
3244
-    public function handle(Request $request): Response
3245
-    {
3246
-        $body = $request->getBody();
3247
-        if (!$body) {
3248
-            $body = file_get_contents('php://input');
3249
-            if ($body) {
3250
-                parse_str($body, $input);
3251
-                foreach ($input as $key => $value) {
3252
-                    if (substr($key, -9) == '__is_null') {
3253
-                        $input[substr($key, 0, -9)] = null;
3254
-                        unset($input[$key]);
3255
-                    }
3256
-                }
3257
-                $request->setBody((object) $input);
3258
-            }
3259
-        }
3260
-        return $this->next->handle($request);
3261
-    }
3262
-}
3263
-
3264 3240
 // file: src/Tqdev/PhpCrudApi/Middleware/JwtAuthMiddleware.php
3265 3241
 
3266 3242
 class JwtAuthMiddleware extends Middleware
@@ -3994,6 +3970,9 @@ abstract class Condition
3994 3970
         if (count($parts) < 2) {
3995 3971
             return null;
3996 3972
         }
3973
+        if (count($parts) < 3) {
3974
+            $parts[2] = '';
3975
+        }
3997 3976
         $field = $table->getColumn($parts[0]);
3998 3977
         $command = $parts[1];
3999 3978
         $negate = false;
@@ -4008,15 +3987,13 @@ abstract class Condition
4008 3987
                 $command = substr($command, 1);
4009 3988
             }
4010 3989
         }
4011
-        if (count($parts) == 3 || (count($parts) == 2 && in_array($command, ['ic', 'is', 'iv']))) {
4012
-            if ($spatial) {
4013
-                if (in_array($command, ['co', 'cr', 'di', 'eq', 'in', 'ov', 'to', 'wi', 'ic', 'is', 'iv'])) {
4014
-                    $condition = new SpatialCondition($field, $command, $parts[2]);
4015
-                }
4016
-            } else {
4017
-                if (in_array($command, ['cs', 'sw', 'ew', 'eq', 'lt', 'le', 'ge', 'gt', 'bt', 'in', 'is'])) {
4018
-                    $condition = new ColumnCondition($field, $command, $parts[2]);
4019
-                }
3990
+        if ($spatial) {
3991
+            if (in_array($command, ['co', 'cr', 'di', 'eq', 'in', 'ov', 'to', 'wi', 'ic', 'is', 'iv'])) {
3992
+                $condition = new SpatialCondition($field, $command, $parts[2]);
3993
+            }
3994
+        } else {
3995
+            if (in_array($command, ['cs', 'sw', 'ew', 'eq', 'lt', 'le', 'ge', 'gt', 'bt', 'in', 'is'])) {
3996
+                $condition = new ColumnCondition($field, $command, $parts[2]);
4020 3997
             }
4021 3998
         }
4022 3999
         if ($negate) {

Loading…
取消
儲存