Laravel Delete Query Builder

In Laravel, you can use the Query Builder to delete records from a database table. The basic syntax for deleting records is as follows:

DB::table('table_name')->where('column_name', 'value')->delete();

This will delete all records from the table_name table where the column_name column has a value of 'value'. You can chain multiple where clauses to create more complex delete statements.

Watch a course Learn object oriented PHP

You can also use the delete() method on a Eloquent model to delete records.

ModelName::where('column_name', 'value')->delete();

Please be careful when using the delete method, because it will delete all rows that match the criteria you provide and it will not fire any model event.