blade-extensions
blade-extensions copied to clipboard
how to pass params
1 @php
2 $array = array_fill(0, 10, 'hello');
3 \Log::info($array);
4 @endphp
5 @wct ({{ $array }})
6
17 public function getDirectives()
18 {
19 \Log::info(__FUNCTION__);
20 return [
21 'wct' => [$this, 'getWechatContentTemplate']
22 ];
23 }
24
33 public function getConditionals()
34 {
35 return [];
36 }
37
38 public function getWechatContentTemplate($values) {
39 \Log::info($values);
40 if(isset($values) && is_array($values) && array_key_exists('code', $values)) {
41 $wct = Esl\WechatContentTemplate::where('code', $values['code'])->first();
42 if(isset($wct)) {
43 return $wct->content;
44 } else {
45 return '';
46 }
47 } else {
48 return '';
49 }
50 }
the log is
[2020-03-21 17:28:36] local.INFO: {{ $array }}