Refactor Value Metrics Class To Enable Easier Customization #3267
Unanswered
MannikJ
asked this question in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find the
Laravel\Nova\Metrics\Value::aggregate
function a bit too verbose. If you try to customize the behavior, you end up with a lot of copy paste. In fact the default implementation also contains code duplication to build the result value. This makes it quite hard to read for my taste.I would suggest changing into something like the following, which divides the same aggregation code into three functions:
This doesn't really save lines of cod, but it encapsules business logic so it is easier to adapt for more complex cases.
Beta Was this translation helpful? Give feedback.
All reactions