Hi,
I'm trying to merge two collections, one of one Model type, and another of another Model type, then sort them by the updated_at field.
$merged = $foo->merge($bar)->sortByDesc('updated_at');
It is overwriting indexes though, but they are number based, like:
Collection {#456 ▼
#items: array:6 [▼
0 => Foo {#463 ▶}
1 => Foo {#464 ▶}
5 => Foo {#468 ▶}
4 => Bar {#376 ▶}
3 => Bar {#394 ▶}
2 => Bar {#395 ▶}
]
}
There should be 9 indexes in the example above.
According to the documentation, these should be appended when there is a number index? Is there an easy workaround to this, or another method to use?
Thanks