我正在尝试以表格形式输入数字(laravel 5.4),但代码无效。
我尝试了不同的选项,但它无效。
<div class="col-md-4 col-md-offset-2">
{!! Form::open(array('route' => 'properties.store', 'data-parsley-validate' => '' , 'files' => true)) !!}
{{ Form::label('address', 'Address:') }}
{{ Form::text('address', null, array('class'=>'form-control', 'placeholder'=>'Street & Number')) }}
</div>
<div class="col-md-4">
{{ Form::label('price_paid', "Price Paid:") }}
{{ Form::number('fuel',null, ['class' => 'form-control']) }}
{{ Form::label('loan_ltv', "Loan to Value:") }}
{{ Form::input('number', 'amount', null, ['class' => 'form-control']) }}
{{ Form::label('rent', "Rent Achievable:") }}
{{ Form::number('name', 'value', ['class' => 'form-control']) }}
{{ Form::label('mortgage', "Mortgage Rate:") }}
{{ Form::number('name', 'value', ['class' => 'form-control']) }}
{{ Form::label('management_moe', "Management and Operating Expenses:") }}
{{ Form::number('name', 'value', ['class' => 'form-control']) }}
{{ Form::submit('Create Property Case', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px;')) }}
</div>
{!! Form::close() !!}
</div>
我尝试了我在这里找到的不同选项,但它没有用。
public function store(Request $request)
{
//validate the data
$this->validate($request, array(
'address' =>'max:255|nullable',
'price_paid' => 'integer|nullable',
'loan_ltv' => 'integer|nullable',
'rent' => 'integer|nullable',
'mortgage' => 'integer|nullable',
'management_moe' => 'integer|nullable'
));
当我提交表单时,我在数据库中看到的唯一内容是街道名称和街道号码。其余行都有空值。
我可以在数据库中手动输入数字,但我想通过表单来完成。有人可以帮助我吗?
答案 0 :(得分:0)
这是我经过大量研究后使用的工作代码:
{{ Form::label('price_paid', "Price Paid:") }}
{{ Form::number('price_paid', null, ['class' => 'form-control']) }}
{{ Form::label('loan_ltv', "Loan to Value:") }}
{{ Form::number('loan_ltv', null, ['class' => 'form-control']) }}
{{ Form::label('rent', "Rent Achievable:") }}
{{ Form::number('rent', null, ['class' => 'form-control']) }}
{{ Form::label('mortgage', "Mortgage Rate:") }}
{{ Form::number('mortgage', null, ['class' => 'form-control']) }}
{{ Form::label('management_moe', "Management and Operating Expenses:") }}
{{ Form::number('management_moe', null, ['class' => 'form-control']) }}