Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bootstrap Toast made easy for Laravel

NotificationsYou must be signed in to change notification settings

WhereIsLucas/laravel-bootstrap-toasts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This package, based onlaracasts/flash provides an interface for Bootstrap 4.2 toast messages.

Installation

Get the package with composer

composer require whereislucas/laravel-bootstrap-toasts

If you are not using Laravel 5.5 or higher, include the service provider within yourconfig/app.php file.

'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.

<linkrel="stylesheet"href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<scriptsrc="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script><scriptsrc="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>

Usage

First of all, include the snippet in your Blade templates

@include('laravel-bootstrap-toasts::message')

Then, in your controller, call thetoast() method to create a toast message.

publicfunctionedit(){toast('Post edited!');returnredirect(route('posts.list'));}

The toast method accepts the title and level optional arguments :

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'.

php artisan vendor:publish --provider="WhereIsLucas\LaravelBootstrapToasts\ToastServiceProvider" --tag="config"

You can publish the view and tweak it if you want!

php artisan vendor:publish --provider="WhereIsLucas\LaravelBootstrapToasts\ToastServiceProvider" --tag="views"

About

Bootstrap Toast made easy for Laravel

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp