flash message in laravel 5.4
How to display a message in laravel after successfull completion of a form post.
Create Controller EmployeeController
1 2 3 4 5 6 7 8 9 10 |
public function addEmployee(Request $request) { if($request->name!='') { Session::flash('emp_msg', 'Success: Data updated Successfully.'); } else { Session::flash('emp_msg', 'Error: There was an error while processing your request.'); } } |
Viewpage blade code will be ..
1 2 3 4 5 |
<div class="flash-message"> @if(Session::has($emp_msg)) <p class="alert">{{ Session::get($emp_msg) }}</p> @endif </div> |