Answers for "laravel delete table data"

PHP
2

delete all rows in table laravel

// Uncomment the below to wipe the table clean before populating

DB::table('table_name')->truncate();

//or

DB::table('table_name')->delete();
Posted by: Guest on September-02-2021
1

laravel clear table

// Delete everythin in the table

// Option 1 
Project::truncate();

// Option 2
Project::whereNotNull('id')->delete();

// Option 3
Project::where('id', 'like' '%%')->delete();

// Option 4
DB::table('projects')->delete();
Posted by: Guest on September-28-2021
0

laravel drop table migration

Schema::drop('users');

Schema::dropIfExists('users');
Posted by: Guest on April-27-2020

Browse Popular Code Answers by Language