I saw that when others use Laravel to develop, they write all database operations in the Model (get and set, etc.), and then they can directly reference the data when they need to use it in the view, like the following, in the view Add this at the beginning:
<?php /** @var Order $Order */?>
Then you can use $Order->id directly in the template. It feels very convenient. I wonder if there are any problems with using it this way? Can thinkphp do this?
Thinkphp seems to have to bind variables in the control to output on the front end. Is there a similar method?
Thanks!!
There is no similar method, we can only modify the template parsing.
Is it to instantiate the Order object? You still need to pass in parameters to call and get the properties.
ThinkPHP can directly $Order = M("Order")->find($id);
Then $Order.id is used.