Answers for "Clear all data in table model laravel"

PHP
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

Browse Popular Code Answers by Language