laracasts/flash

一个flash消息的插件

  1. composer require laracasts/flash
  2. configapp.php
    //provider
    'LaracastsFlashFlashServiceProvider'
    //aliases
    'Flash'  => 'LaracastsFlashFlash'
  3. 视图blade中调用
    @include('flash::message')
    <script src="/js/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script type="text/javascript">
         //modal框样式
             $('#flash-overlay-modal').modal();
            //或者普通样式
        $('div.alert').not('.alert-important').delay(3000).slideUp(300);
    </script>
  4. 控制器调用,两种区别只是颜色不同而已
            flash('Your article has been created!');
            flash()->success('Your article has been created!');
         //使用modal
    flash()->overlay('Your article has been created!','Good Job');
原文地址:https://www.cnblogs.com/fenle/p/4808213.html