定制 airoinfo/laravel-alert 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

airoinfo/laravel-alert

Composer 安装命令:

composer require airoinfo/laravel-alert

包简介

A simple PHP package to show alerts with the Laravel Framework and Vue

README 文档

README

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 require 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
	Airo\Alert\AlertServiceProvider::class,
]
'alias' => [
	'Alert' => Airo\Alert\AlertFacade::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\AlertFacade;
class HomeController
{
	public function login()
	{
		//when Login success
		Alert::success(['message1', 'message2', '...']);

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

统计信息

  • 总下载量: 419
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-05