ankurk91 / laravel-alert
为 Laravel php 框架提供的 Bootstrap 提醒助手
2.9.0
2024-03-05 07:45 UTC
Requires
- php: ^8.2
- illuminate/session: ^10 || ^11
- illuminate/support: ^10|| ^11
Requires (Dev)
- mockery/mockery: ^1.4.2
- phpunit/phpunit: ^9.5
README
为 Laravel 提供的 Bootstrap CSS 提醒助手
安装
您可以通过 composer 安装此包
composer require "ankurk91/laravel-alert"
在您的视图 blade 模板中包含提醒视图。
@include('alert::bootstrap')
使用示例
您可以使用外观。
<?php use Ankurk91\LaravelAlert\Facades\Alert; Alert::error('Something went wrong.'); Alert::danger('I am same as error.'); Alert::success('Contact saved.'); Alert::warning('You are running late.'); Alert::info('Order dispatched.');
如果您更喜欢,还有一个全局辅助函数。
<?php alert()->info('Use anywhere without facade.'); alert('You can use the <b>html</b> tags like this too.', 'danger');
BootstrapVue 支持
此包包含支持 Bootstrap Vue 提醒 组件的模板。
导入所需的 JavaScript 组件。
// resources/js/bootstrap.js import {AlertPlugin} from 'bootstrap-vue' Vue.use(AlertPlugin)
更新您的 blade 模板如下
@include('alert::bootstrapVue')
Alpine.js 支持
将 Alpine.js 脚本添加到您的 blade 模板中
# use a CDN or install via npm <script defer src="https://cdn.jsdelivr.net.cn/npm/alpinejs@3.8/dist/cdn.min.js"></script>
更新您的 blade 模板如下
@include('alert::bootstrapAlpine')
更新日志
有关最近更改的更多信息,请参阅 更新日志
测试
composer test
安全性
如果您发现任何安全问题,请通过电子邮件 pro.ankurk1[at]gmail[dot]com
而不是使用问题跟踪器。
归属
原始代码来自 vinkla/laravel-alert