|
@@ -36,6 +36,7 @@ class LuticateGroupsDataAccess extends LuDataAccess {
|
36
|
36
|
return null;
|
37
|
37
|
return $group->toDbo();
|
38
|
38
|
}
|
|
39
|
+
|
39
|
40
|
public static function getUsers($group_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
|
40
|
41
|
{
|
41
|
42
|
$model = LuticateUsers::/*where("luticate_users.username", "ilike", "%" . $query . "%")
|
|
@@ -58,6 +59,28 @@ class LuticateGroupsDataAccess extends LuDataAccess {
|
58
|
59
|
return new LuMultipleDbo($count, $usersLight);
|
59
|
60
|
}
|
60
|
61
|
|
|
62
|
+ public static function getOtherUsers($group_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
|
|
63
|
+ {
|
|
64
|
+ $model = LuticateUsers::/*where("luticate_users.username", "ilike", "%" . $query . "%")
|
|
65
|
+ ->where("luticate_users.email", "ilike", "%" . $query . "%", "or")
|
|
66
|
+ ->where("luticate_users.firstname", "ilike", "%" . $query . "%", "or")
|
|
67
|
+ ->where("luticate_users.lastname", "ilike", "%" . $query . "%", "or")
|
|
68
|
+ ->*/where("luticate_users_groups.group_id", "!=", $group_id, "and")
|
|
69
|
+ ->join("luticate_users_groups", "luticate_users.id", "=", "luticate_users_groups.user_id");
|
|
70
|
+
|
|
71
|
+ $count = $model->count();
|
|
72
|
+
|
|
73
|
+ $model = $model->orderBy("luticate_users.username", "ASC");
|
|
74
|
+ $data = $model->take($perPage)->offset($page * $perPage)->get();
|
|
75
|
+ $usersLight = [];
|
|
76
|
+ foreach ($data as $user) {
|
|
77
|
+ if (!is_null($user)) {
|
|
78
|
+ $usersLight[] = LuticateUsersLightDbo::fromUserDbo($user->toDbo());
|
|
79
|
+ }
|
|
80
|
+ }
|
|
81
|
+ return new LuMultipleDbo($count, $usersLight);
|
|
82
|
+ }
|
|
83
|
+
|
61
|
84
|
public static function addUser($user_id, $group_id)
|
62
|
85
|
{
|
63
|
86
|
LuticateGroups::find($group_id)->users()->attach($user_id);
|