Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f1uder/laravel-notification
Simple toast notifications for Laravel + Livewire + AlpineJS
https://github.com/f1uder/laravel-notification
alpinejs laravel livewire notice toast-notifications
Last synced: 2 months ago
JSON representation
Simple toast notifications for Laravel + Livewire + AlpineJS
- Host: GitHub
- URL: https://github.com/f1uder/laravel-notification
- Owner: f1uder
- License: mit
- Created: 2022-08-19T00:29:55.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T17:37:48.000Z (over 1 year ago)
- Last Synced: 2024-10-01T09:23:35.795Z (3 months ago)
- Topics: alpinejs, laravel, livewire, notice, toast-notifications
- Language: Blade
- Homepage:
- Size: 15.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Livewire Notification (+ AlpineJS)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/f1uder/laravel-notification.svg?style=flat-square)](https://packagist.org/packages/f1uder/laravel-notification)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/f1uder/laravel-notification/Fix%20PHP%20code%20style%20issues?label=code%20style)](https://github.com/f1uder/laravel-notification/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/f1uder/laravel-notification.svg?style=flat-square)](https://packagist.org/packages/f1uder/laravel-notification)## Installation
You can install the package via composer:
```bash
composer require f1uder/laravel-notification
```Publish the config file with:
```bash
php artisan vendor:publish --tag="laravel-notification"
```Add css file (notification.css)
```css
@import "../../public/vendor/laravel-notification/css/notification.css";@tailwind base;
@tailwind components;
@tailwind utilities;
```Add code to template, after body tag
```html
...```
## Usage Laravel
```php
return redirect('/')->notice('message text', 'alert');
``````php
return redirect()->route('home')->notice('message text', 'info');
```## Usage Livewire component
```php
$this->notice('message text', 'alert');
``````php
return redirect('/')->notice('message text', 'alert');
```## Usage alpineJS
```js
$dispatch('notice', {message: 'message text', type: 'alert'});
```
## ArgumentsUsage: `notice($message, $type, $timer, $title)`
* `$message` - Message.
* `$type` - Notification type.
* `alert`
* `info` - default
* `success`
* `$timer` - 3000 default = 3 sec.
* `$title` - Notification header. Default = null.## Config
`config/notification.php`
* `$timer` - Notification display time in seconds.
* `$position` - Notification position.
* `tr` - Top right (default).
* `tl` - Top left.
* `br` - Bottom right.
* `bl` - Bottom left.## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.