I am trying to set up a component for a text input for forms in Laravel 7. I have a Country which is fine and the correct element is pass to my form.
My form starts:
{{ Form::model($country, array('route' => array('countries.basic', $country->id), 'class' => 'form-horizontal','files' => true)) }}
{{ Form::token() }}
<table class="table">
<x-textInput :label="country" :name="country" :value="$country->country" required="required" />
<tr>
<td>abbreviation</td>
<td><input type="text" id="abbreviation" name="abbreviation" value="{{ $country->abbreviation }}" data-alias="" class="form-control" required style="width:40px"></td>
</tr>
<tr>
<td>capital:</td>
<td><input type="text" id="capital" name="capital" value="{{ $country->capital }}" data-alias="" class="form-control" required></td>
</tr>
<tr>
<td>main cities:</td>
<td><textarea id="textarea_1" name="mainCities" rows="3" data-alias="" class="form-control">{{ $ct->mainCities }}</textarea></td>
</tr>
I have the class OK and the component php file reads:
<div>
<tr>
<td>{{ $label }}:</td>
<td><input type="text" id="{{ $name }}" name="{{ $name }}" value="{{ $value }}" data-alias="" class="form-control" {{ $required }}></td>
</tr>
</div>
When I try to run the form I get the following error:
Use of undefined constant country - assumed 'country'
The source code of the form renders as:
There is definitely a column "capital".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…