Illuminate\Database\Query\Builder::delete PHP Method

delete() public method

Delete a record from the database.
public delete ( mixed $id = null ) : integer
$id mixed
return integer
    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());
    }

Usage Example

Example #1
0
 function delete($id)
 {
     $retId = $this->operator->delete($id);
     if ($retId) {
         //todo if here a bug ?
         $obj[$this->pkey] = $retId;
     }
     return $id;
 }
All Usage Examples Of Illuminate\Database\Query\Builder::delete