public function __invoke() { $messages = array(); if ($this->flashMessenger->hasMessages()) { $messages['common'] = $this->flashMessenger->getMessages(); } if ($this->flashMessenger->hasSuccessMessages()) { $messages['success'] = $this->flashMessenger->getSuccessMessages(); } if ($this->flashMessenger->hasInfoMessages()) { $messages['info'] = $this->flashMessenger->getInfoMessages(); } if ($this->flashMessenger->hasErrorMessages()) { $messages['danger'] = $this->flashMessenger->getErrorMessages(); } if ($this->flashMessenger->hasWarningMessages()) { $messages['warning'] = $this->flashMessenger->getWarningMessages(); } return $messages; }