下面是我的组件标记input.blade.php。
<div>
<div class="form-group">
<label for="{{$name}}"> {{$label}}
@if($required) </label><span class="text-danger pl-1">*</span> @endif
<input
class="form-control"
onkeyup="document.getElementById('account_holder_name').value = this.value"
value="{{ old($name) ?? $value }}"
name="{{$name}}"
type="text" id="{{$name}}"
aria-required="{{$required}}"
required="{{$required}}">
</div>
@error("{{$name}}")
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
我想通过 :value = $supplier->name
而不是下面,我通过
@php $name = $supplier->name @endphp
<x-forms.input type='text' name='name' label='Name' :value=$name required=true />
像这样吗?
<x-forms.input type="text" name="name" label="Name" value="{{$supplier->name}}" required="true" />