Skip to content

tinghom/laravel-alert

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Laravel-alert

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

Install

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,
]

Setup

1. Published vendor

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

2. Register your Vue component

e.g resource\js\app.js

Vue.component('notify-component', require('./components/NotifyComponent.vue'));

3. Include notify blade to your layout

e.g views\layouts\app.blade.php

@include('alert::notify')

4. Use it in Controller

use Airo/Alert;
class HomeController
{
	public function login()
	{
		//when Login success
		Alert::success(['message1', 'message2', '...']);

		//when login fail
		Alert::errors(['message1', 'message2', '...']);
	}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 64.9%
  • Vue 23.4%
  • HTML 11.7%