可能?将刀片模板分配给变量

时间:2017-08-06 14:47:17

标签: php laravel blade

我想将刀片模板分配给刀片中的变量以进行代码组织。

所以基本上我们说我有变量λ curl -XGET -u elastic:elasticpassword http://192.168.1.71:9200/test/mytype/_search?pretty -d'{"query":{"term":{"age":10}}}' { "took" : 6, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1, "max_score" : 1.0, "hits" : [ { "_index" : "test", "_type" : "mytype", "_id" : "2", "_score" : 1.0, "_source" : { "name" : "Dio", "age" : 10 } } ] } } λ curl -XGET -u elastic:elasticpassword http://192.168.1.71:9200/test/mytype/_search?pretty -d'{"query":{"term":{"name":"Paul"}}}' { "took" : 5, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } }

包含

的刀片模板admin.actions
$response['actions']

我希望基本上能够做类似

的事情
<a href="javascript:void(0);" class="btn btn-success btn-sm" onclick="loadLeadComments('.$lead->id.')">

所以它在变量

中呈现html

1 个答案:

答案 0 :(得分:3)

使用render() method

 $response['actions'] = view()
                        ->make('admin.actions', array('lead' => $lead))
                        ->render(); 

这个想法与使用控制器中的数据返回视图相同,最后将render()方法链接在一起。

相关问题