My guess was to use the following syntax:
MyModel::all()->delete();
But that did not work. I\'m sure it\'s super simple, but I\'ve searched
I wanted to add another option for those getting to this thread via Google. I needed to accomplish this, but wanted to retain my auto-increment value which truncate()
resets. I also didn't want to use DB::
anything because I wanted to operate directly off of the model object. So, I went with this:
Model::whereNotNull('id')->delete();
Obviously the column will have to actually exists, but in a standard, out-of-the-box Eloquent model, the id
column exists and is never null. I don't know if this is the best choice, but it works for my purposes.