public function render($types = array('error', 'warning', 'success', 'info')) { $res = ''; if (\Messages::any()) { $res .= '<br/>'; } foreach ($types as $type) { foreach (\Messages::instance()->get($type) as $message) { $res .= '<div class="alert alert-' . $message['type'] . '">' . $message['body'] . '</div>' . "\n"; } } \Messages::reset(); return $res; }
<?php if (\Messages::any()) { ?> <br/> <?php foreach (array('success', 'info', 'warning', 'error') as $type) { ?> <?php $class = $type == 'error' ? 'danger' : $type; ?> <?php foreach (\Messages::instance()->get($type) as $message) { ?> <div class="alert alert-<?php echo $class; ?> "><?php echo $message['body']; ?> </div> <?php } ?> <?php } ?> <?php \Messages::reset(); }