php - Laravel 5.2 flash messages not working -


i using use flash; display flash messages not showing

protected function store(request $request) {     $this->validate($request, [         'service_name' => 'required'     ]);      $service = new service();     $service->service_name = $request->input('service_name');     $service->business_id = auth::user()->user_id;     $service->save();      flash::message('service added');      return redirect('/business/editservices');     } 

view code

@if (session::has('flash_notification.message'))  <div class="alert alert-{{ session::get('flash_notification.level') }}">  <button type="button" class="close" data-dismiss="alert"   aria-hidden="true">&times;</button>    {{ session::get('flash_notification.message') }} </div>   @endif 

what might problem?please help

if have request object use flash:

protected function store(request $request) {  $this->validate($request, [     'service_name' => 'required' ]);  $service = new service(); $service->service_name = $request->input('service_name'); $service->business_id = auth::user()->user_id; $service->save();  $request->session()->flash('message', 'service added');  return redirect('/business/editservices'); } 

or esiaer using redirect:

return redirect('/business/editservices')->with('message', 'service added'); 

and then:

session::has('message'); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -