一个flash消息的插件
-
composer require laracasts/flash
- configapp.php
//provider 'LaracastsFlashFlashServiceProvider' //aliases 'Flash' => 'LaracastsFlashFlash'
- 视图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>
- 控制器调用,两种区别只是颜色不同而已
flash('Your article has been created!'); flash()->success('Your article has been created!');
//使用modal
flash()->overlay('Your article has been created!','Good Job');