Преглед изворни кода

group users filter

tags/0.1.0
Robin Thoni пре 8 година
родитељ
комит
4e902d367b
1 измењених фајлова са 6 додато и 8 уклоњено
  1. 6
    8
      src/Auth/DataAccess/LuticateGroupsDataAccess.php

+ 6
- 8
src/Auth/DataAccess/LuticateGroupsDataAccess.php Прегледај датотеку

38
     }
38
     }
39
     public static function getUsers($group_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
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
         $count = $model->count();
48
         $count = $model->count();
51
 
49
 

Loading…
Откажи
Сачувај