Laravel 애플리케이션에서 플래시 메시지를 보내는 가벼운 패키지. 이 패키지는 한 번에 하나의 단일 플래시 메시지 만 지원하며 플래시 메시지는 토스트 알림 형식으로 표시됩니다.
composer require bkstar123/flashing
그런 다음 패키지의 자산을 게시해야합니다.
php artisan vendor:publish --provider="Bkstar123FlashingFlashingServiceProvider"
블레이드보기 요소를 응용 프로그램의 resources/views/vendor/bkstar123_flashing/flashing.blade.php 에 복사합니다. 이보기 요소를 자유롭게 사용자 정의 할 수 있습니다. 또한 패키지의 JavaScript 파일을 응용 프로그램의 public/js/vendor/bkstar123)handling/*.js
a) 관점에서
보기 또는 마스터 레이아웃에는 @include('bkstar123_flashing::flashing') 에 패키지의보기 요소를 포함시킵니다.
b) 컨트롤러 방법
상자 밖에서 패키지는 메시지를 플래시하기위한 다음 툴셋을 제공합니다.
Bkstar123FlashingFacadesFlashing facade. 또는 별명 Flashing 사용할 수 있습니다flashing() 도우미 기능패키지는 다음 유형의 플래시 메시지를 지원합니다.
예 :
<?php
// Flash a info-typed message by default
Flashing:: message ( ' Welcome to the home page ' )
-> flash ();
flashing ( ' Welcome to the home page ' )
-> flash ();
// Flash a success-typed message
Flashing:: message ( ' Welcome to the home page ' )
-> success ()
-> flash ();
flashing ( ' Welcome to the home page ' )
-> success ()
-> flash ();
// Flash a message and mark it as important i.e it will not disappear until being dismissed by yourself
Flashing:: message ( ' Important message ' )
-> important ()
-> flash ();
flashing ( ' Important message ' )
-> important ()
-> flash ();
// Specify the miliseconds for timing out the flash message
// The given timeout will be ignored if you mark the flash message as important
Flashing:: message ( ' This message will disappear after 3 seconds ' )
-> timeout ( 3000 )
-> flash ();
flashing ( ' This message will disappear after 3 seconds ' )
-> timeout ( 3000 )
-> flash ();
// Specify the location of the flash message, it can be either top-right or bottom-right
Flashing:: message ( ' I will be on the top-right of your screen ' )
-> position ( ' top ' )
-> flash ();
flashing ( ' I will be on the top-right of your screen ' )
-> position ( ' top ' )
-> flash (); 모든 방법 success() | error() | warning() | info() 는 message() 후에 묶을 수 있고 important(), timeout() & position() 에 의해 묶을 수 있습니다. 마지막으로, 당신은 항상 flash() 체인에 추가해야합니다.
참고 : flashing('hello world') <=> Flashing::message('hello world')