https://github.com/attla/flash-messages
✨ Intuitive package to flash notifications on laravel
https://github.com/attla/flash-messages
Last synced: 3 months ago
JSON representation
✨ Intuitive package to flash notifications on laravel
- Host: GitHub
- URL: https://github.com/attla/flash-messages
- Owner: attla
- License: mit
- Created: 2022-07-30T08:18:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-25T01:07:52.000Z (over 2 years ago)
- Last Synced: 2025-02-20T14:46:29.942Z (4 months ago)
- Language: PHP
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dynamic flash messages for laravel
✨ Intuitive package to flash notifications on laravel.
## Installation
```bash
composer require attla/flash-messages
```## Configuration
To publish the configuration file, run the following command:
```bash
php artisan vendor:publish --tag=attla/flash-messages/config
```
The `types` array on configuration is usaded to indicate the class to the message.
The `icons` are default icons for each message type.
## Usage
For create a new message you call the facade method as the type name from the configuration
```php
use Attla\Flash\Facade as Flash;
// Create a flash message with the helper function
$flash = flash('Example of message', 'info');
// Create with facade
$flash = Flash::info('Example of message');// Set the message as dismissible
$flash->dismissible();// Set a custom class for the message
$flash->class('custom-message-class');// Set a icon for the message
$flash->icon('far fa-circle-info');
$flash->icon('');// Set a timeout for the message
$flash->timeout(6); // will be removed after 6 seconds// If needed, you can unqueue the message
$flash->destory();```
### List of message methods
| Method | Parameters | Description |
|--|--|--|
| ``dismissible()`` | - | Make the message disposable |
| ``timeout(seconds)`` | Integer | The message will be removed after the time |
| ``class(class)`` | String | Set a custom class for the message |
| ``destory()`` | - | Unqueue the message |
| ``delete()`` | - | Alias for ``destory()`` |
| ``forget()`` | - | Alias for ``destory()`` |
| ``unset()`` | - | Alias for ``destory()`` |
| ``unqueue()`` | - | Alias for ``destory()`` |## License
This package is licensed under the [MIT license](LICENSE) © [Octha](https://octha.com).