获取错误'第一个参数应该是字符串或整数'在Laravel 5.2

时间:2016-06-03 14:35:08

标签: laravel-5 laravel-5.2 laravelcollective

我尝试使用以下代码构建简单的登录表单:

{!! Form::open(['class'=>'login-form', 'method'=>'post', 'action'=>'AdminUserController@store']) !!}
    <h3 class="form-title">Sign In</h3>
    <div class="alert alert-danger display-hide">
        <button class="close" data-close="alert"></button>
                    <span>
        Enter your email and password. </span>
    </div>
    <div class="form-group">
        <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
        {!! Form::label('email', 'Email ID', array('class' => 'control-label visible-ie8 visible-ie9')) !!}
        {!! Form::text(['class'=>'form-control form-control-solid placeholder-no-fix','type'=>'email', 'autocomplete'=>'off', 'placeholder'=>'Email ID','name'=>'email']) !!}
    </div>
    .
    .
    .
    .
{!! Form::close() !!}

我收到了以下错误:

enter image description here

请帮忙

1 个答案:

答案 0 :(得分:1)

Form::text()的论据是错误的。

而不是

Form::text(['class'=>'form-control form-control-solid placeholder-no-fix','type'=>'email', 'autocomplete'=>'off', 'placeholder'=>'Email ID','name'=>'email'])

你应该

Form::email('email', null, ['class'=>'form-control form-control-solid placeholder-no-fix', 'autocomplete'=>'off', 'placeholder'=>'Email ID'])

根据docs