我有以下代码:
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
@include('component.input',[
'label' => 'Last Name',
'name' => 'last_name',
'type' => 'text',
'placeholder' => 'Li',
'class' => '',
'errorMessage' => "required"
])
</div>
我想做类似的事情:
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
@include('component.input',[
'label' => 'Last Name',
'name' => 'last_name',
'type' => 'text',
'placeholder' => "{{Auth::user()->last_name}}"
'class' => '',
'errorMessage' => "required"
])
</div>
但是返回语法错误。
答案 0 :(得分:0)
您在@include
标记内时处于PHP上下文中,因此您可以直接使用Facade:
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
@include('component.input',[
'label' => 'Last Name',
'name' => 'last_name',
'type' => 'text',
'placeholder' => Auth::user()->last_name,
'class' => '',
'errorMessage' => "required"
])
</div>