A helper function for handling Laravel 5 session success or error messages

Here is a small snippet of code, which can be dropped into a helper.php file. function message_alert($timeout = 0) { $return = ”; //If has errors if( !empty(Session::get(‘errors’)) ){ $return .= ‘<div class=”fixed-bottom alert alert-danger mb-0″><div class=”container”> <ul class=”mb-0″>’; foreach ( Session::get(‘errors’)->all() as $error ): $return .= ‘<li>’. $error .'</li>’; endforeach; $return .= ‘</ul> </div></div>’; […]