kgp43
6 months ago
48
1
Nova

Problems with array_sum in Nova?

Posted 6 months ago by kgp43

Hi,

Is there is problem with array_sum in Nova? Getting "Expecting parameter 1 to be an array".

I think this should work, or have I made a mistake?

                Text::make('Costprice', function () {
                    $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
                    $arr = json_decode($json);
                    return array_sum($arr);
                })->hideFromIndex(),

Should return 15

Please sign in or create an account to participate in this conversation.