title: Laravel validation - ErrorException in helpers.php line 466: htmlentities() expects parameter 1 to be string, object given
body: <p>So, I followed the laravel documentation to create a validator. But every time the validation fails, I get a nasty "ErrorException in helpers.php line 466".
  If I dump the $validator before the redirect, everything seems to be perfect and all the errors are there. But, after the redirect, I get the problem.</p>
  
  <p>routes.php</p>
  
  <pre><code>Route::group(['as' =&gt; 'todas'], function(){
    Route::group(['middleware' =&gt; ['web'], 'as' =&gt; 'web', 'namespace' =&gt; 'Web'], function(){
      Route::group(['middleware' =&gt; ['auth'], 'prefix' =&gt; 'dashboard', 'as' =&gt; 'privadas', 'namespace' =&gt; 'Privadas'], function(){
        Route::get('criar', ['uses' =&gt; 'PrivateController@criar', 'as' =&gt; 'criar']);
        Route::post('salvar', ['uses' =&gt; 'FestaController@salvar', 'as' =&gt; 'salvar']);
      });
    });
  });
  </code></pre>
  
  <p>kernel.php</p>
  
  <pre><code>protected $middlewareGroups = [
      'web' =&gt; [
          \App\Http\Middleware\EncryptCookies::class,
          \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
          \Illuminate\Session\Middleware\StartSession::class,
          \Illuminate\View\Middleware\ShareErrorsFromSession::class,
          \App\Http\Middleware\VerifyCsrfToken::class,
      ],
      'api' =&gt; [
          'throttle:60,1',
      ],
  ];
  protected $routeMiddleware = [
      'auth' =&gt; \App\Http\Middleware\Authenticate::class,
      'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
      'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
      'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
  ];
  </code></pre>
  
  <p>The controller</p>
  
  <pre><code>namespace App\Http\Controllers\Web\Privadas;
  
  use Illuminate\Http\Request;
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  use Validator;
  
  class FestaController extends Controller
  {
      public function salvar(Request $request){
        $validator = Validator::make($request-&gt;all(),[
          'numConvidados' =&gt; 'required|numeric|min:1',
          'inicioFesta'   =&gt; 'required|date|before:' . $request-&gt;fimFesta,
          'fimFesta'      =&gt; 'required|date|after:' . $request-&gt;inicioFesta . '|mais_x_dias:' . $request-&gt;inicioFesta . ',1'
        ]);
        if ($validator-&gt;fails()){
          return redirect('dashboard/criar')
            -&gt;withErrors($validator)
            -&gt;withInput();
        }
        dd('success');
      }
  }
  </code></pre>
  
  <p>The part of the view which contains the $errors variable</p>
  
  <pre><code>@section('subHeader')
  @if (count($errors) &gt; 0) {{-- Div de erros --}}
    &lt;div class="alert alert-danger"&gt;
      {{$errors}}
      &lt;strong&gt;{{ trans('mensagens.opa-algo-deu-errado')}}&lt;/strong&gt;
      &lt;br&gt;
      &lt;ul&gt;
        @foreach ($errors-&gt;all() as $error)
          &lt;li&gt;{{ $error }}&lt;/li&gt;
        @endforeach
      &lt;/ul&gt;
    &lt;/div&gt;
  @endif
  @endsection
  </code></pre>
  
  <p>The error is called:
  ErrorException in helpers.php line 466:
  htmlentities() expects parameter 1 to be string, object given (View: E:[....]\resources\views\privadas\criar-evento.blade.php)</p>
  
  <pre><code>in helpers.php line 466
  at CompilerEngine-&gt;handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
  at PhpEngine-&gt;evaluatePath('E:\Profissional\photo2me\Repos\photo2me\storage\framework\views/07ef3b6137fe5cd5f04a28b6acfeb98af95e1888.php', array('__env' =&gt; object(Factory), 'app' =&gt; object(Application), 'errors' =&gt; object(ViewErrorBag))) in CompilerEngine.php line 59
  at CompilerEngine-&gt;get('E:\Profissional\photo2me\Repos\photo2me\resources\views/privadas/criar-evento.blade.php', array('__env' =&gt; object(Factory), 'app' =&gt; object(Application), 'errors' =&gt; object(ViewErrorBag))) in View.php line 142
  at View-&gt;getContents() in View.php line 113
  at View-&gt;renderContents() in View.php line 82
  at View-&gt;render() in Response.php line 53
  at Response-&gt;setContent(object(View)) in Response.php line 197
  at Response-&gt;__construct(object(View)) in Router.php line 1030
  at Router-&gt;prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
  at ControllerDispatcher-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in ControllerDispatcher.php line 96
  at ControllerDispatcher-&gt;callWithinStack(object(PrivateController), object(Route), object(Request), 'criar') in ControllerDispatcher.php line 54
  at ControllerDispatcher-&gt;dispatch(object(Route), object(Request), 'App\Http\Controllers\Web\Privadas\PrivateController', 'criar') in Route.php line 174
  at Route-&gt;runController(object(Request)) in Route.php line 140
  at Route-&gt;run(object(Request)) in Router.php line 703
  at Router-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
  at Authenticate-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
  at VerifyCsrfToken-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
  at ShareErrorsFromSession-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 62
  at StartSession-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
  at AddQueuedCookiesToResponse-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
  at EncryptCookies-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Router.php line 705
  at Router-&gt;runRouteWithinStack(object(Route), object(Request)) in Router.php line 678
  at Router-&gt;dispatchToRoute(object(Request)) in Router.php line 654
  at Router-&gt;dispatch(object(Request)) in Kernel.php line 246
  at Kernel-&gt;Illuminate\Foundation\Http\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
  at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Kernel.php line 132
  at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 99
  at Kernel-&gt;handle(object(Request)) in index.php line 54
  </code></pre>