https://github.com/GeekGhc/LaraFlashcss
composer
安裝composer require geekghc/flash
或者在你的composer.json
裏require
部分添加html
"geekghc/flash":"~2.0"
config/app.php
添加service provider
'providers' => [ GeekGhc\LaraFlash\FlashProvider::class, ];
爲了方便使用 能夠再去添加一個alias
jquery
'aliases' => [ 'LaraFlash'=>GeekGhc\LaraFlash\Flash::class, ];
public function store() { LaraFlash::success("Welcome Aboard!"); return Redirect::home(); }
notification
視圖@include('laraflash::notification')
或者git
@include('laraflash::header-notification')
LaraFlash::success('Message')github
LaraFlash::info('Message')json
LaraFlash::error('Message')app
LaraFlash::warning('Message')composer
laraflash()
這樣的helper function
laraflash('Message!') 默認爲info
ide
laraflash()->success('Message!')
laraflash()->info('Message!')
laraflash()->error('Message!')
laraflash()->warning('Message!')
在此以前使用CDN
的形式引入jquery
和font-awesome
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> </head> <body> <script src="//cdn.bootcss.com/jquery/2.1.0/jquery.min.js"></script> @include('laraflash::notification') </body> </html>
php artisan vendor:publish
resources/views/vendor/laraFlash
目錄下