美文网首页
Laravel-Flash

Laravel-Flash

作者: 刘斤欠 | 来源:发表于2018-03-21 12:38 被阅读0次

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 ̄)> !

相关文章

  • Laravel-Flash

    composer安装 composer require laracasts/flash 接下来,如果使用larav...

网友评论

      本文标题:Laravel-Flash

      本文链接:https://www.haomeiwen.com/subject/lunwqftx.html