This package is base on Laravel Framwork 、Vue and Element UI also optional support vue-notification Easy to create awesome notify view and Laravel Facade to call on backend
Important make sure your larval project’s Vue and Element UI is working fine.
Use composer to install package
$ composer required airoinfo/laravel-alert
notice if your Laravel version is beyond 5.6, package’ll auto register ServiceProvider to app.php. But if your version is above 5.6, you’ve to register by yourself.
config/app.php
'provider' => [
// package ServiceProvider
Airoinfo/laravel-alert/AlertServiceProvider::class,
]
'alias' => [
'Alert' => 'Alert' => Airoinfo\laravel-alert\Alert::class,
]
In this package, we already provide blade and Vue component. You can use it by default, or also create your own to catch the message
Publish View Blade to resource\vendor\notify
$ php artisan vendor:publish --tag=views --force
Publish Vue component to resource\js\components
$ php artisan vendor:publish —-tag=components --force
e.g resource\js\app.js
Vue.component('notify-component', require('./components/NotifyComponent.vue'));
e.g views\layouts\app.blade.php
@include('alert::notify')
use Airo/Alert;
class HomeController
{
public function login()
{
//when Login success
Alert::success(['message1', 'message2', '...']);
//when login fail
Alert::errors(['message1', 'message2', '...']);
}
}