Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whereislucas/laravel-bootstrap-toasts
Bootstrap Toast made easy for Laravel
https://github.com/whereislucas/laravel-bootstrap-toasts
bootstrap-4 bootstrap4 laravel laravel5 toasts
Last synced: 6 days ago
JSON representation
Bootstrap Toast made easy for Laravel
- Host: GitHub
- URL: https://github.com/whereislucas/laravel-bootstrap-toasts
- Owner: WhereIsLucas
- Created: 2019-01-14T16:41:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-31T12:45:39.000Z (over 1 year ago)
- Last Synced: 2024-09-27T19:03:26.976Z (6 days ago)
- Topics: bootstrap-4, bootstrap4, laravel, laravel5, toasts
- Language: PHP
- Size: 12.7 KB
- Stars: 27
- Watchers: 4
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Bootstrap flash messages for your Laravel app
This package, based on `laracasts/flash` provides an interface for Bootstrap 4.2 toast messages.
## Installation
Get the package with composer
```bash
composer require whereislucas/laravel-bootstrap-toasts
```If you are not using Laravel 5.5 or higher, include the service provider within your `config/app.php` file.
```php
'providers' => [
WhereIsLucas\LaravelBootstrapToasts\ToastServiceProvider::class,
];
```This package is made for Bootstrap 4.2 and higher, be sure to include the css and js files on your page.
```html
```
```html```
## Usage
First of all, include the snippet in your Blade templates
```html
@include('laravel-bootstrap-toasts::message')
```Then, in your controller, call the `toast()` method to create a toast message.
```php
public function edit()
{
toast('Post edited!');
return redirect(route('posts.list'));
}
```The toast method accepts the title and level optional arguments :
```php
toast('message','level','title')
```There are a few quick methods to modify the toast:
- `toast('Message')->success()`: Set the toast level as "success".
- `toast('Message')->info()`: Set the toast level as "info".
- `toast('Message')->error()`: Set the toast level as "danger".
- `toast('Message')->warning()`: Set the toast level as "warning".- `toast('Message')->title("Toast title")`: Set the toast title.
- `toast('Message')->important()`: Add a close button to the toast.## Configuration & personalization
You can publish the configuration file to tweak the position of the toast or the default value for 'autohide'.
```bash
php artisan vendor:publish --provider="WhereIsLucas\LaravelBootstrapToasts\ToastServiceProvider" --tag="config"
```
You can publish the view and tweak it if you want!
```bash
php artisan vendor:publish --provider="WhereIsLucas\LaravelBootstrapToasts\ToastServiceProvider" --tag="views"
```