composer安裝
composer require laracasts/flash
接下來,如果使用laravel 5,則在config/app.php文件中包含服務(wù)提供者
'providers'=>[Laracasts\Flash\FlashServiceProvider::class,];
Flash消息的默認(rèn)CSS類是針對Twitter引導(dǎo)優(yōu)化的。因此,在html或布局文件中插入引導(dǎo)程序的CSS
<link hrel="stylesheet">
然后在控制器內(nèi)設(shè)置你想要的效果,控制器里可以這樣寫
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 ̄)> !