I want to write some data to my database, if the query fails I want to display an error. I tried the following:
return redirect()->back()->with('data', ['Database Error!']);
The redirect works great, but I cant read out the response in $data
My Blade:
@if (session()->has('data'))
<div class="alert alert-danger" role="alert">...</div>
@endif
//Second try
<?php if(session('data')) echo $message; ?>
But both methods doesn't work, i read a lot of L5.2 Docs but nothing works.
Do i need to modify the session config?!? Or what is the problem?