我有这个代码
{{ Form::number('amount', (isset($logged_in_user->paymentConfirmation->amount) ? floor($logged_in_user->paymentConfirmation->amount) : null), ['class' => 'form-control', 'maxlength' => '13','step' => '1']) }}
如何将长度限制为13位数?
Laravel Collective Forms将Form::number
渲染为<input type="number">
元素。所以你需要在这里使用max
,它的值必须是允许的最大整数:
{!! Form::number('amount', (isset($logged_in_user->paymentConfirmation->amount) ? floor($logged_in_user->paymentConfirmation->amount) : null), ['class' => 'form-control', 'max' => '9999999999999', 'step' => '1']) !!}