| @@ 288-304 (lines=17) @@ | ||
| 285 | return $this; |
|
| 286 | } |
|
| 287 | ||
| 288 | public function update($table = null) |
|
| 289 | { |
|
| 290 | if ($table) { |
|
| 291 | $this->table($table); |
|
| 292 | } |
|
| 293 | ||
| 294 | $sql = 'UPDATE ' . $this->table . ' SET '; |
|
| 295 | $sql .= $this->setField(); |
|
| 296 | ||
| 297 | if (!empty($this->wheres)) { |
|
| 298 | $sql .= ' WHERE ' . implode('', $this->wheres); |
|
| 299 | } |
|
| 300 | ||
| 301 | $this->query($sql, $this->bindings); |
|
| 302 | ||
| 303 | return $this; |
|
| 304 | } |
|
| 305 | ||
| 306 | public function delete($table = null) |
|
| 307 | { |
|
| @@ 306-321 (lines=16) @@ | ||
| 303 | return $this; |
|
| 304 | } |
|
| 305 | ||
| 306 | public function delete($table = null) |
|
| 307 | { |
|
| 308 | if ($table) { |
|
| 309 | $this->table($table); |
|
| 310 | } |
|
| 311 | ||
| 312 | $sql = 'DELETE FROM ' . $this->table . ' '; |
|
| 313 | ||
| 314 | if (!empty($this->wheres)) { |
|
| 315 | $sql .= ' WHERE ' . implode('', $this->wheres); |
|
| 316 | } |
|
| 317 | ||
| 318 | $this->query($sql, $this->bindings); |
|
| 319 | ||
| 320 | return $this; |
|
| 321 | } |
|
| 322 | ||
| 323 | private function setField() |
|
| 324 | { |
|