Microweber\Providers\DatabaseManager::delete_by_id PHP Method

delete_by_id() public method

Deletes item by id from db table.
public delete_by_id ( string $table, integer | string $id, string $field_name = 'id' ) : boolean
$table string Your da table name
$id integer | string The id to delete
$field_name string You can set custom column to delete by it, default is id
return boolean
    public function delete_by_id($table, $id = 0, $field_name = 'id')
    {
        if ($id === 0) {
            return false;
        }
        if (is_array($id)) {
            foreach ($id as $remove) {
                $c_id = $this->table($table)->where($field_name, '=', $remove)->delete();
            }
        } else {
            $c_id = $this->table($table)->where($field_name, '=', $id)->delete();
        }
        Cache::tags($table)->flush();
        return $c_id;
    }