Laravel-Flash

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容