I have a simple piece of code that I would like to use inside the blade template:
@if($errors->has())
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
@endif
However in order to use $errors, I read somewhere that I need to use web
middleware so I set that as well for the route:
'middleware' => ['web']
and added:
$app->register(Illuminate\Session\Middleware\StartSession::class);
$app->register(Illuminate\View\Middleware\ShareErrorsFromSession::class);
to the app.php
But now, when I open this route, I'm getting this error:
lumen.ERROR: exception 'ErrorException' with message 'Argument 1 passed to Illuminate\Session\Middleware\StartSession::__construct() must be an instance of Illuminate\Session\SessionManager, instance of Laravel\Lumen\Application given