If you're on MySQL (and you probably are) try to turn off foreign key checks using this statement before you truncate data in tables with foreign key constraints.
<?php
DB::statement("SET foreign_key_checks = 0");
A reasonable place to put this would be app/database/seeds/DatabaseSeeder.php
at the beginning of run()
method.
I use DB::table('lessons')->delete();
@Oliver Thanks for different solution, I haven't tried but in my case setting foreign key check more reasonable.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community