一个flash消息的插件
-
composer require laracasts/flash
- config\app.php
//provider ‘Laracasts\Flash\FlashServiceProvider‘ //aliases ‘Flash‘ => ‘Laracasts\Flash\Flash‘
- 视图blade中调用
@include(‘flash::message‘)
<script src="//cdn.bootcss.com/jquery/3.0.0-alpha1/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‘);
时间: 2024-10-12 14:51:39