-
Type:
New Feature
-
Resolution: Declined
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Laravel
-
None
-
None
-
None
-
None
-
None
-
None
-
None
masterbater has created Issue #3231: latestOfMany() doesnt work in laravel-mongodb. This Jira ticket was filed by GromNaN
Issue Text:
- Laravel-mongodb Version: 5.1
- PHP Version: 8.3
- Database Driver & Version:
Description:
Steps to reproduce
doesnt work it doesnt return the latest value,
public function latestTwilioMessage(): HasOne { return $this->hasOne(TwilioMessageHistory::class)->latestOfMany('date_sent'); }
checking latestOfMany method it uses
public function latestOfMany($column = 'id', $relation = null) { return $this->ofMany((new Collection(Arr::wrap($column)))->mapWithKeys(function ($column) { return [$column => 'MAX']; })->all(), 'MAX', $relation); }
For now I use this, seems to work ok.
public function latestTwilioMessage(): HasOne { return $this->hasOne(TwilioMessageHistory::class)->latest('date_sent'); }
- depends on
-
PHPORM-286 Support DB aggregate by group
-
- Closed
-
- is duplicated by
-
PHPORM-84 Implement Laravel latestOfMany / oldestOfMany
-
- Backlog
-