حزمة خفيفة الوزن لإرسال رسائل الفلاش في تطبيقات 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 في التطبيق الخاص بك
أ) في الرأي
في العرض أو التصميم الرئيسي ، فقط قم بتضمين عنصر عرض الحزمة مع @include('bkstar123_flashing::flashing')
ب) في طرق وحدة التحكم
خارج المربع ، توفر لك الحزمة مجموعة الأدوات التالية لمواجهة رسالة:
Bkstar123FlashingFacadesFlashing الواجهة الوامضة. بدلاً من ذلك ، يمكنك استخدام الاسم Flashingflashing() وظيفة المساعدتدعم الحزمة الأنواع التالية من الرسائل الوامضة:
مثال :
<?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() يمكن ربط success() | error() | warning() | info() بعد message() وكذلك بالسلاسل بواسطة important(), timeout() & position() . في النهائي ، يجب دائمًا إلحاق flash() إلى السلسلة.
ملاحظة : flashing('hello world') <=> Flashing::message('hello world')