Answer the question
In order to leave comments, you need to log in
How to correctly display data from a collection in twig, using an example?
I am working with Eloquent collections and need to pass them to Twig. I have such a collection $product = Product::find($id);
Since this is one product, in theory it can be displayed in a twig either in a cycle, or like this {{ product.0.name }}
.
Are there any other options in Twig, perhaps more correct?
Answer the question
In order to leave comments, you need to log in
This is not a collection. This is a model object. No, you can't cycle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question