Now can include WHERE clause on showAll() method

This commit is contained in:
2017-09-07 11:21:15 +07:00
parent 041e4dd2dd
commit cf7d5b4c5a
3 changed files with 43 additions and 22 deletions

View File

@@ -144,18 +144,9 @@ abstract class Model
try {
$db = static::connectDB();
$result = $this->showAll('id', '=', $id);
foreach ($result as $post) {
foreach ($post as $key => $val) {
if (isset($args[$key])) {
if ($args[$key] == $post[$key]) {
return false;
}
}
}
}
$result = $this->showAll([
['id', '=', $id]
]);
$sql = "UPDATE {$table} SET {$fields} WHERE id = ?";