Explorar o código

add 其他字段搜索

visuddhinanda %!s(int64=2) %!d(string=hai) anos
pai
achega
cf46854187
Modificáronse 1 ficheiros con 12 adicións e 1 borrados
  1. 12 1
      app/Http/Controllers/RelationController.php

+ 12 - 1
app/Http/Controllers/RelationController.php

@@ -29,7 +29,18 @@ class RelationController extends Controller
         if(($request->has('search'))){
             $table = $table->where('name', 'like', $request->get('search')."%");
         }
-
+        if(($request->has('from'))){
+            $table = $table->whereJsonContains('from->case',$request->get('from'));
+        }
+        if(($request->has('to'))){
+            $table = $table->whereJsonContains('to',$request->get('to'));
+        }
+        if(($request->has('match'))){
+            $table = $table->whereJsonContains('match',$request->get('match'));
+        }
+        if(($request->has('category'))){
+            $table = $table->where('category',$request->get('category'));
+        }
         $table = $table->orderBy($request->get('order','updated_at'),$request->get('dir','desc'));
         $count = $table->count();