Search code examples
laravel-5laravelcollective

Getting error 'The first argument should be either a string or an integer' in Laravel 5.2


I'm trying to build simple login form using following code:

{!! 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() !!}

and I'm getting following error:

enter image description here

Please help


Solution

  • Your arguments for Form::text() are wrong.

    Instead of

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

    You should have

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

    As per the docs.