Laravel - Delete all records from table query

July 5, 2018 | Category : Laravel 5 Laravel PHP

Do you require to delete all data from table using laravel eloquent? If yes then you can get a solution for your problem. We can easily remove all records from table using DB class with delete().

But if you need to destroy all records using laravel eloquent model then how you will do it?, Actually i cache my all records and when someone remove that records then automatic remove from cache too. but it is possible if you are doing with laravel eloquent model. So is there method truncate() with eloquent but it is not working for me, so finally i found solution for delete all records from database table using following way.

Just check bellow all example and i hope it will work for you:

Solution 1:


Solution 2:


Solution 3:

User:where('id', 'like' '%%')->delete();

Solution 4:


I hope you found your solution....