After the upgrade from Laravel 5.2 to 5.3 I'm not able the add the Flash message.
This is the code we use:
return redirect()->back()->with('alert-success', 'My Message');
And for displaying the message:
@foreach (['danger', 'warning', 'success', 'info'] as $msg)
@if(Session::has('alert-' . $msg))
<div class="alert alert-{{ $msg }} alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
{{ Session::get('alert-' . $msg) }}
</div>
@endif
@endforeach
We also cannot use the login messages if we provider wrong credentials:
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
{{ csrf_field() }}
<div class="form-group has-feedback {{ $errors->has('email') ? ' has-error' : '' }}">
<input type="email" name="email" class="form-control" placeholder="Email" value="{{ old('email') }}">
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
<div class="form-group has-feedback {{ $errors->has('password') ? ' has-error' : '' }}">
<input type="password" name="password" class="form-control" placeholder="Password">
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
<div class="row">
<!-- /.col -->
<div class="col-xs-12">
<button type="submit" class="btn btn-primary btn-block btn-flat">
Login
</button>
</div>
</div>
</form>