tonystore/livewire-notification
最新稳定版本:v1.1.1
Composer 安装命令:
composer require tonystore/livewire-notification
包简介
Laravel package to launch toast notifications.
README 文档
README
This package provides assistance when using toast notifications. Using the iziTOAST package, which allows us to launch elegant and responsive notifications, having the facility to apply a number of configurations that you will find available on their official site .
REQUIREMENTS
INSTALLATION VIA COMPOSER
Step 1: Composer
Run this command line in console.
composer require tonystore/livewire-notification
Step 2: Include component
Add the iziTOAST CDN styles and script, and the component containing the script to launch the notifications.
<head>
<link href="https://cdn.jsdelivr.net/npm/izitoast@1.4.0/dist/css/iziToast.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
...
@livewireScripts
...
<script src="https://cdn.jsdelivr.net/npm/izitoast@1.4.0/dist/js/iziToast.min.js">
</script>
...
//INSERT COMPONENT
<x-livewire-notification::toast />
//OR
@component('livewire-notification::components.toast') @endcomponent
</body>
Publish Config File
php artisan vendor:publish --provider="Tonystore\LivewireNotification\LivewireNotificationProvider" --tag="config"
Default configuration
//config/livewire-notification return [ 'toast' => [ 'title' => '', //Defaut Title 'position' => 'topRight', //Defaut Position 'timeout' => 3000, //Display Time 'modal' => null, //Very important, it defines if an event is triggered to close a Bootstrap modal. ],
Usage
Now, in any Livewire component, you can launch notifications. To launch a notification you can choose between the different types available:
- success
- info
- error
- warning
Example 1
Launch a simple notification with a personalized message.
$this->alert( 'success', 'Example of notification.', );
Example 2
Example of notification with modal event.
$this->alert('info','Example of notification with modal event', [ 'modal' => '#hideModal' ] );
To use more configurations, you can check the documentation on their official site .
统计信息
- 总下载量: 4.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-22