retinens/laravel-toastr
最新稳定版本:v1.2.0
Composer 安装命令:
composer require retinens/laravel-toastr
包简介
This package provides an easy interface for using toastr.js in a Laravel app.
README 文档
README
This package provides an easy interface for using Toastr.js messages in your Laravel app.
Installation
You can install the package via composer:
composer require retinens/laravel-toastr
You can publish the config file with:
php artisan vendor:publish --tag="laravel-toastr-config"
This is the contents of the published config file:
return [ /* * Defines the default auto_hide parameter */ 'auto_hide' => false, /* * Defines the position of the toast on the window */ // "top" or "bottom" "position_y" => 'bottom', // "start" or "end" "position_x" => 'end', ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="laravel-toastr-views"
Usage
Toastr should be imported in your assets and available in the window variable.
For example, in your app.js file:
import * as toastr from 'toastr' window.toastr = toastr
@import '~toastr/build/toastr.scss';
Include the component in your blade base template, after all the scripts.
<x-toastr/>
Then, in your controller, call the toastr() method to create a toast message.
public function update() { //do stuff toastr('Post edited!'); return redirect(route('posts.index')); }
The toast method accepts the title and level as optional arguments :
toastr('message','level','title')
There are a few quick methods to modify the toast:
-
toastr()->success('Message'): Set the toast level as "success". -
toastr()->info('Message'): Set the toast level as "info". -
toastr()->error('Message'): Set the toast level as "danger". -
toastr()->warning('Message'): Set the toast level as "warning". -
toastr()->title('Message',"Toast title"): Set the toast title.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-14