nova-flexible-content icon indicating copy to clipboard operation
nova-flexible-content copied to clipboard

Any idea why it doesn't get cast in Laravel Nova action (but does in the route)

Open HeadStudios opened this issue 1 year ago • 2 comments

So I have a code that cycles through some products

foreach($opps as $opp) {

                ray($opp);
                $items = array();
                ray($opp->products);
                foreach($opp->products as $product) {
                    $items[] = ['rate' => $product->price, 'productname' => $product->product_name, 'productfeature' => $product->product_benefit];
                }

Everything works beautifully and as you can see I use Ray and it comes out with Eloquent for the products stuff which is Whitecube - it loops through everything is beautiful output:

https://share.getcloudapp.com/RBuZ4GnO

As you can see it gets cast to the Whitecube collection but.... when I do the same thing except in an action I get following: https://share.getcloudapp.com/WnuDBOy6

So for some reason it doesn't get cast - here's the code starting in my action: https://share.getcloudapp.com/geuy4LmN

So.. I'm investigating the cause now but if you have any input on why it fails to cast (and is needing me to rewrite the code) it would be much appreciated. Thanks!

HeadStudios avatar Sep 22 '22 02:09 HeadStudios