I have this collection:
'1234' => [
[
'name' => 'test',
'date' => '2020-12-10'
],
[
'name' => 'another test'
'date' => '2020-12-10'
],
[
'name' => 'another test'
'date' => '2020-12-11'
],
[
'name' => 'another test'
'date' => '2020-12-11'
]
],
'4321' => [
[
'name' => 'test',
'date' => '2020-03-04'
],
[
'name' => 'another test'
'date' => '2020-03-04'
],
[
'name' => 'another test'
'date' => '2020-08-06'
],
[
'name' => 'another test'
'date' => '2020-08-06'
]
]
]
The 1234 and 4321 are IDs of a subscription. There's a lot of those.
The items inside are notifications sent for each of them. There could be 1 to 4 UNIQUE notifications and each one could repeat twice, so up to 8 records.
So it's like this
Notification January
Notification January
Notification February
Notification February
Notification March
Notification March
Now obviously those are timestamps.
I want to order each Subscription's notifications by date and then extract ALL first notifications in a $first
collection, all second notifications in $second
collection and so on up to fourth.
So in $first
there should be the earliest sent notification for all subscriptions and any duplicates.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire