@@ -68,14 +68,21 @@ public function getIndex(Request $request)
6868 $ match = str_replace ('" ' , '' , $ match );
6969 if (strpos ($ match , ': ' )) {
7070 list ($ field , $ term ) = explode (': ' , $ match );
71- $ field = (strpos ($ field , '. ' )) ? $ field : 'servers. ' . $ field ;
71+ if ($ field === 'node ' ) {
72+ $ field = 'nodes.name ' ;
73+ } else if (!strpos ($ field , '. ' )) {
74+ $ field = 'servers. ' . $ field ;
75+ }
76+
7277 $ query ->orWhere ($ field , 'LIKE ' , '% ' . $ term . '% ' );
7378 } else {
7479 $ query ->where ('servers.name ' , 'LIKE ' , '% ' . $ match . '% ' );
75- $ query ->orWhere ('servers.username ' , 'LIKE ' , '% ' . $ match . '% ' );
76- $ query ->orWhere ('users.email ' , 'LIKE ' , '% ' . $ match . '% ' );
77- $ query ->orWhere ('allocations.port ' , 'LIKE ' , '% ' . $ match . '% ' );
78- $ query ->orWhere ('allocations.ip ' , 'LIKE ' , '% ' . $ match . '% ' );
80+ $ query ->orWhere ([
81+ ['servers.username ' , 'LIKE ' , '% ' . $ match . '% ' ],
82+ ['users.email ' , 'LIKE ' , '% ' . $ match . '% ' ],
83+ ['allocations.port ' , 'LIKE ' , '% ' . $ match . '% ' ],
84+ ['allocations.ip ' , 'LIKE ' , '% ' . $ match . '% ' ],
85+ ]);
7986 }
8087 }
8188 }
0 commit comments