Skip to content

Commit a5822c9

Browse files
authored
Merge pull request #37 from vc-urvin/main
Add quotes in SQL query
2 parents 8f742e6 + 0c3f4e3 commit a5822c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Traits/Audit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public function getConstraintField(string $tableName, string $input): array
108108
}
109109

110110
if($input === Constant::CONSTRAINT_INDEX_KEY) {
111-
$result = DB::select("SHOW INDEX FROM {$tableName} where Key_name != 'PRIMARY' and Key_name not like '%unique%'");
111+
$result = DB::select("SHOW INDEX FROM `{$tableName}` where Key_name != 'PRIMARY' and Key_name not like '%unique%'");
112112
} else {
113-
$result = DB::select("SHOW KEYS FROM {$tableName} WHERE Key_name LIKE '%" . strtolower($input) . "%'");
113+
$result = DB::select("SHOW KEYS FROM `{$tableName}` WHERE Key_name LIKE '%" . strtolower($input) . "%'");
114114
}
115115

116116

0 commit comments

Comments
 (0)