I make test in Laravel, and I want to truncate all users, and create only one. This code show me error SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint
. What can I do that truncate users ? Just I don't want to use solutions that violate database settings, e.g.Schema::disableForeignKeyConstraints();
public function test_delete_user()
{
DB::table('users')->truncate();
$role = User::factory()->create();
.......
}