示例#1
0
 /**
  * Execute the query as a DELETE statement.
  *
  * Optionally, an ID may be passed to the method do delete a specific row.
  *
  * @param  int   $id
  * @return int
  */
 public function delete($id = null)
 {
     // If an ID is given to the method, we'll set the where clause
     // to match on the value of the ID. This allows the developer
     // to quickly delete a row by its primary key value.
     if (!is_null($id)) {
         $this->where('id', '=', $id);
     }
     $sql = $this->grammar->delete($this);
     return $this->connection->delete($sql, $this->bindings);
 }