Answers for "laravel clear table"

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
0

empty table in laravel

MyModel::truncate();
Posted by: Guest on June-19-2020
0

truncate table laravel eloquent

Visitor::query()->truncate();
Posted by: Guest on July-24-2020

Browse Popular Code Answers by Language