-
When I try to bulk delete models with destroy() the order of arguments/array is ignored. For example Post::destroy(1, 2) and Post::destroy(2, 1) will always delete id 1 for first. I haven't found a reference for that, it's normal behavior? Laravel 7.11 |
Beta Was this translation helpful? Give feedback.
Answered by
jmarcher
Jul 3, 2020
Replies: 1 comment
-
The entries will be deleted in the natural order of your table. foreach ($instance->whereIn($key, $ids)->get() as $model) {
if ($model->delete()) {
$count++;
}
} That is the code used by |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
GrahamCampbell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The entries will be deleted in the natural order of your table.
That is the code used by
Model::destroy(...)