BaseModel::deleteMany
Usage
int BaseModel::deleteMany(string $where_sql, [ ... $args ])Description
Delete multiple records from the database table assigned to the model class.Parameters
Parameter | Required | Type | Description |
---|---|---|---|
$where_sql | Yes | string | The WHERE clause within the SQL statement. Can contain placeholders (eg. %s, %i, %b, et al). |
$args | No | desc= |
Return Value
Integer of how many records were deleted.Examples
Delete All Products Less Than 24.95
use App\Demo\Models\Product;
$price = 24.95;
$num = Product::deleteMany('price < %d', $price);
echo "Total of $num products deleted.\n";