Laravel-Flash

composer安装

composer require laracasts/flash


接下来,如果使用laravel 5,则在config/app.php文件中包含服务提供者

'providers'=>[Laracasts\Flash\FlashServiceProvider::class,];


Flash消息的默认CSS类是针对Twitter引导优化的。因此,在html或布局文件中插入引导程序的CSS

<link hrel="stylesheet"href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">


然后在控制器内设置你想要的效果,控制器里可以这样写

public function test()

{

         flash('message')->important()->error();

          return redirect('/land');

}


还有很多各种你想要不想要的样式,你可以都试试看

flash('Message')->success(): Set the flash theme to "success".

flash('Message')->error(): Set the flash theme to "danger".

flash('Message')->warning(): Set the flash theme to "warning".

flash('Message')->overlay(): Render the message as an overlay.

flash()->overlay('Modal Message', 'Modal Title'): Display a modal overlay with a title.

flash('Message')->important(): Add a close button to the flash message.

flash('Message')->error()->important(): Render a "danger" flash message that must be dismissed.  


模板这样写就对了,记得一定要引入css/js样式,写上三要素,这样div就可以弹出你想要的框框

视图三要素

最后贴上Github地址     Laravel-Flash

Bye <( ̄3 ̄)> !

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容