Skip to content

Commit 80826cb

Browse files
committed
Update where statement
1 parent fbaecc3 commit 80826cb

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

src/Authorization/Authorization.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ public static function hasAuthorization(int $userId, ...$authorization): bool
1616
$db->select($value);
1717
}
1818

19-
$db->where([
20-
'id',
21-
['?' => $userId]
22-
]);
19+
$db->where(
20+
Database::expr()->eq('id', '?', $userId)
21+
);
2322
$results = $db->fetch();
2423
foreach ($results as $value) {
2524
if ($value !== 1) {
@@ -44,10 +43,9 @@ private static function userInTable(int $userId)
4443
$userIsset =
4544
Database::queryBuilder('authorization')
4645
->select('id')
47-
->where([
48-
'id',
49-
['?' => $userId]
50-
])
46+
->where(
47+
Database::expr()->eq('id', '?', $userId)
48+
)
5149
->fetch();
5250

5351
if ($userIsset === false) {
@@ -66,10 +64,9 @@ public static function changeMultipleAuthorizations(int $userId, array $authoriz
6664
$listAuth[$key] = $value;
6765
}
6866
$db->update($listAuth);
69-
$db->where([
70-
'id',
71-
['id' => $userId]
72-
]);
67+
$db->where(
68+
Database::expr()->eq('id', '?', $userId)
69+
);
7370
$db->execute();
7471
}
7572

@@ -85,10 +82,9 @@ private static function changeAuthorization(
8582
$authorization => $auth
8683
]
8784
);
88-
$db->where([
89-
'id',
90-
['id' => $userId]
91-
]);
85+
$db->where(
86+
Database::expr()->eq('id', '?', $userId)
87+
);
9288
$db->execute();
9389
}
9490
}

0 commit comments

Comments
 (0)