Reputation: 103
I have one question. I want to tranfer object data from controller to the view. What way is better:
Upvotes: 0
Views: 43
Reputation: 1480
The standard and, in my opinion, best way would be the first one.
Passing objects to the view allows you to use the same data structures across the entire application. If you have a Car
model, for example, you may do something like this in a service:
$model = $car->getModel();
And in a view you would do something like this:
{{ car.model }}
Being consistent is a desirable attribute.
Upvotes: 1