Laravel 5.1: htmlentities () ожидает, что параметр 1 будет строкой, заданный массив

Я столкнулся с ошибкой: «htmlentities () ожидает, что параметр 1 будет строкой, массив указан», когда я отлаживаю свой код, эта строка от контроллера бросает ошибку.

return redirect()->back()->withErrors($validator)->withInput(); 

контроллер

  $rules = array( 'email' => 'required|email|unique:inspector_details', // required and must be unique in the ducks table ); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { $messages = $validator->messages(); return redirect()->back()->withErrors($validator)->withInput(); } 

ПОСМОТРЕТЬ

  {!! Form::open(array('route' => 'inspector.store','class' => 'form','id' => 'createinspector','name' => 'createinspector','files' => true)) !!} <input type="hidden" name="_token" value="{{ csrf_token() }}"> <input type="hidden" name="uid" id="uid" value="" /> <div class="col-md-6"> <div class="form-group"> <label>Name<span class="redmark">&nbsp;*</span></label> <input type="text" class="form-control" name="firstname" id="firstname" style="margin-bottom: 3px" value="{{ Input::old('firstname') }}" placeholder="Enter Name" required="required"> </div> <div class="form-group"> <label>Email<span class="redmark">&nbsp;*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope"></i></span> <input type="email" class="form-control" name="email" id="email" placeholder="Email" value="{{ Input::old('email') }}" required="required"> </div> <input type="checkbox" name="emailprivate" value="{{ Input::old('emailprivate') }}" id="emailprivate" style="margin-top: 3%">&nbsp;&nbsp;<span style="font-weight : 100" >Keep email private.</span> </div> <div class="form-group"> <label>Zip Code<span class="redmark" id="zipvalidation" style="font-weight : 100;display: none">&emsp;Enter either 5 or 9 digits.</span></label> <input type="text" class="form-control" name="zip" id="zip" onkeydown="validateNumber(event);" maxlength="9" value="{{ Input::old('zip') }}" placeholder="Enter Zip Code"> </div> <div class="form-group"> <label>Company<span class="redmark">&nbsp;*</span></label> <input type="text" class="form-control" name="company" id="company" value="{{ Input::old('company') }}" placeholder="Enter Company Name"> </div> <div class="form-group"> <label>Website</label> <input type="url" class="form-control" name="website" id="website" value="{{ Input::old('website') }}" placeholder="Enter Website url eg http://www.google.com"> </div> <div class="form-group"> <label>Phone Number</label> <div class="input-group"> <div class="input-group-addon"> <i class="fa fa-phone"></i> </div> <input type="text" class="form-control" name="phone" id="phone" onkeydown="validateNumber(event);" value="{{ Input::old('phone') }}" placeholder="Enter Phone number"> </div> </div> <div class="form-group"> <label>Free text</label> <textarea class="form-control" rows="2" name="freetext" id="freetext" value="{{ Input::old('freetext') }}" placeholder="Enter Text"></textarea> </div> <div class="form-group"> <label for="exampleInputFile">Select logo</label> {!! Form::file('logoimage', null) !!} <p class="help-block"></p> </div> <!-- /.form-group --> </div> <!-- /.col --> <div class="col-md-6"> <div class="form-group"> <label>Inspection Type</label> <select class="form-control select2" name="inspectiontype[]" id="inspectiontype" value="{{ Input::old('inspectiontype') }}" multiple="multiple" data-placeholder="Select Inspection Type" style="width: 100%;"> <option value="home" selected="selected">home</option> <option value="roof">roof</option> <option value="asbestos">asbestos</option> <option value="lead">lead</option> <option value="HVAC">HVAC</option> <option value="pest">pest</option> <option value="septic">septic</option> <option value="environmental">environmental</option> <option value="plumbing">plumbing</option> <option value="zoning">zoning</option> <option value="mold">mold</option> <option value="wood destroyin g organisms (WDO)">wood destroying organisms (WDO)</option> </select> </div> <div class="form-group"> <label>Company Begin Date:</label> <div class="input-group date"> <div class="input-group-addon"> <i class="fa fa-calendar"></i> </div> <input type="text" class="form-control pull-right" name="companybegindate" id="companybegindate" value="{{ Input::old('companybegindate') }}" id="datepicker"> </div> <!-- /.input group --> </div> <div class="form-group"> <label>street address 1<span class="redmark">&nbsp;*</span></label> <input type="text" class="form-control" name="residaddress1" id="residaddress1" value="{{ Input::old('residaddress1') }}" placeholder="Enter Street Address 1"> </div> <div class="form-group"> <label>street address 2<span class="redmark">&nbsp;*</span></label> <input type="text" class="form-control" name="residaddress2" id="residaddress2" value="{{ Input::old('residaddress2') }}" placeholder="Enter Street Address 2"> </div> <div class="form-group"> <label>City</label> <input type="text" class="form-control" name="city" id="city" value="{{ Input::old('city') }}" placeholder="Enter City"> </div> <div class="form-group"> <label>State<span class="redmark" id="statevalidation" style="font-weight : 100;display: none">&emsp;Enter two characters only eg NJ</span></label> <input type="text" class="form-control" name="state" id="state" value="{{ Input::old('state') }}" placeholder="Enter State eg NJ"> </div> <div class="form-group"> <label>Licensing:</label> <input type="text" class="form-control" name="licname" id="licname" value="{{ Input::old('licname') }}" style="margin-bottom: 2px" placeholder="Enter Licensing name"> <input type="text" class="form-control" name="licid" id="licid" style="margin-bottom: 2px" value="{{ Input::old('licid') }}" placeholder="Enter Licensing ID"> <input type="text" class="form-control" name="licurl" id="licurl" style="margin-bottom: 2px" value="{{ Input::old('licurl') }}" placeholder="Enter URL to governing body"> </div> <!-- /.form-group --> </div> <div class="col-md-12"> <div class="box-footer pull-left"> <button type="submit" class="btn btn-primary" onclick="return validate_data()">Create Inspector</button> </div> </div> {!! Form::close() !!} 

Любая помощь высоко ценится..