Procházet zdrojové kódy

group users filter

tags/0.1.0
Robin Thoni před 8 roky
rodič
revize
4e902d367b

+ 6
- 8
src/Auth/DataAccess/LuticateGroupsDataAccess.php Zobrazit soubor

@@ -38,14 +38,12 @@ class LuticateGroupsDataAccess extends LuDataAccess {
38 38
     }
39 39
     public static function getUsers($group_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
40 40
     {
41
-        $model = LuticateUsers::where("luticate_users_groups.group_id", "=", $group_id);
42
-        if (!is_null($query) && $query != "") {
43
-            $model->where("luticate_users.username", "ilike", "%" . $query . "%")
44
-                ->where("luticate_users.email", "ilike", "%" . $query . "%")
45
-                ->where("luticate_users.firstname", "ilike", "%" . $query . "%")
46
-                ->where("luticate_users.lastname", "ilike", "%" . $query . "%");
47
-        }
48
-        $model->join("luticate_users_groups", "luticate_users.id", "=", "luticate_users_groups.user_id");
41
+        $model = LuticateUsers::where("luticate_users.username", "ilike", "%" . $query . "%")
42
+            ->where("luticate_users.email", "ilike", "%" . $query . "%", "or")
43
+            ->where("luticate_users.firstname", "ilike", "%" . $query . "%", "or")
44
+            ->where("luticate_users.lastname", "ilike", "%" . $query . "%", "or")
45
+            ->where("luticate_users_groups.group_id", "=", $group_id, "and")
46
+            ->join("luticate_users_groups", "luticate_users.id", "=", "luticate_users_groups.user_id");
49 47
 
50 48
         $count = $model->count();
51 49
 

Načítá se…
Zrušit
Uložit