If you need to truncate more than one table, you can remove the CASCADE keyword and provide a comma-separated list of table names.
$tables = [ 'roles', 'role_users', 'users', 'revisions', ]; if (count($tables) > 1) { DB::statement('TRUNCATE TABLE ' . implode(',', $tables) . ';'); } else { DB::statement('TRUNCATE TABLE ' . $tables[0] . ' CASCADE;'); }
source share