delete() public method

Run a delete statement against the database.
public delete ( string $query, array $bindings = [] ) : integer
$query string
$bindings array
return integer
Example #1
0
 /**
  * Delete a record from the database.
  *
  * @param  mixed  $id
  * @return int
  */
 public function delete($id = null)
 {
     // If an ID is passed to the method, we will set the where clause to check
     // the ID to allow developers to simply and quickly remove a single row
     // from their database without manually specifying the where clauses.
     if (!is_null($id)) {
         $this->where('id', '=', $id);
     }
     $sql = $this->grammar->compileDelete($this);
     return $this->connection->delete($sql, $this->getBindings());
 }
 /**
  * {@inheritdoc}
  */
 public function deletePermission(PermissionInterface $permission)
 {
     $this->connection->delete('DELETE FROM ' . $this->getAclSchema()->getPermissionsTableName() . ' WHERE requester = :requester AND resource = :resource', ['requester' => $permission->getRequester()->getAclRequesterIdentifier(), 'resource' => $permission->getResource()->getAclResourceIdentifier()]);
 }