diff --git a/.idea/laravel-notifier.iml b/.idea/laravel-notifier.iml
index fc90a89..0c00683 100644
--- a/.idea/laravel-notifier.iml
+++ b/.idea/laravel-notifier.iml
@@ -39,7 +39,6 @@
-
diff --git a/.idea/php.xml b/.idea/php.xml
index 9b372b9..a90e5cc 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -43,7 +43,6 @@
-
@@ -63,6 +62,9 @@
+
+
+
diff --git a/README.md b/README.md
index 7fe5aa9..4a8cce7 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,31 @@ Call one of these methods in your controllers to insert a notification:
- `Notify::add($type: warning|error|info|success, $message, $title = null, $options = [])` - add a notification
- `Notify::clear()` - clear all current notification
+If you need to show the notification only if a particular condition is true, you can use these methods:
+
+- `Notify::ifWarning($condition, $message, $title = null, $options = [])` - add a warning notification if $condition is true
+- `Notify::ifError($condition, $message, $title = null, $options = [])` - add an error notification if $condition is true
+- `Notify::ifInfo($condition, $message, $title = null, $options = [])` - add an info notification if $condition is true
+- `Notify::ifSuccess($condition, $message, $title = null, $options = [])` - add a success notification if $condition is true
+
+Example:
+instead of use this:
+
+```php
+if($condition){
+ Notify::success('You have an email!', 'New Email');
+}
+```
+
+you can use this:
+
+```php
+Notify::IfSuccess($condition, 'You have an email!', 'New Email');
+```
+
+```php
+{!! notify() !!}
+
```
### EXAMPLE:
diff --git a/composer.lock b/composer.lock
index 37d2e63..f382a03 100644
--- a/composer.lock
+++ b/composer.lock
@@ -168,16 +168,16 @@
},
{
"name": "illuminate/collections",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/collections.git",
- "reference": "3859367b55d977bcf5da86680c787dffaaacdb86"
+ "reference": "358fd6dcce6927ee9d7cf520fa619f4597020d52"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/collections/zipball/3859367b55d977bcf5da86680c787dffaaacdb86",
- "reference": "3859367b55d977bcf5da86680c787dffaaacdb86",
+ "url": "https://api.github.com/repos/illuminate/collections/zipball/358fd6dcce6927ee9d7cf520fa619f4597020d52",
+ "reference": "358fd6dcce6927ee9d7cf520fa619f4597020d52",
"shasum": ""
},
"require": {
@@ -219,20 +219,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2024-05-05T15:36:09+00:00"
+ "time": "2024-06-28T20:14:10+00:00"
},
{
"name": "illuminate/conditionable",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/conditionable.git",
- "reference": "8a558fec063b6a63da1c3af1d219c0f998edffeb"
+ "reference": "362dd761b9920367bca1427a902158225e9e3a23"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/conditionable/zipball/8a558fec063b6a63da1c3af1d219c0f998edffeb",
- "reference": "8a558fec063b6a63da1c3af1d219c0f998edffeb",
+ "url": "https://api.github.com/repos/illuminate/conditionable/zipball/362dd761b9920367bca1427a902158225e9e3a23",
+ "reference": "362dd761b9920367bca1427a902158225e9e3a23",
"shasum": ""
},
"require": {
@@ -265,20 +265,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2024-04-04T17:36:49+00:00"
+ "time": "2024-06-28T20:10:30+00:00"
},
{
"name": "illuminate/contracts",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
- "reference": "8782f75e80ab3e6036842d24dbeead34a16f3a79"
+ "reference": "eb8ccfbc5905c5631712d157cccdd7bc9db692e0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/contracts/zipball/8782f75e80ab3e6036842d24dbeead34a16f3a79",
- "reference": "8782f75e80ab3e6036842d24dbeead34a16f3a79",
+ "url": "https://api.github.com/repos/illuminate/contracts/zipball/eb8ccfbc5905c5631712d157cccdd7bc9db692e0",
+ "reference": "eb8ccfbc5905c5631712d157cccdd7bc9db692e0",
"shasum": ""
},
"require": {
@@ -313,20 +313,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2024-04-17T14:09:55+00:00"
+ "time": "2024-07-01T21:58:24+00:00"
},
{
"name": "illuminate/filesystem",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/filesystem.git",
- "reference": "56d387455019a0b3c19b76dc7ccb70e337ee7c4b"
+ "reference": "43b8d2af61dd6ca882e192fa4ca803d2294d4507"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/filesystem/zipball/56d387455019a0b3c19b76dc7ccb70e337ee7c4b",
- "reference": "56d387455019a0b3c19b76dc7ccb70e337ee7c4b",
+ "url": "https://api.github.com/repos/illuminate/filesystem/zipball/43b8d2af61dd6ca882e192fa4ca803d2294d4507",
+ "reference": "43b8d2af61dd6ca882e192fa4ca803d2294d4507",
"shasum": ""
},
"require": {
@@ -380,20 +380,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2024-03-29T08:58:54+00:00"
+ "time": "2024-06-28T20:10:30+00:00"
},
{
"name": "illuminate/macroable",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/macroable.git",
- "reference": "e1be58f9b2af73f242dc6a9add1f376b3ec89eef"
+ "reference": "e1cb9e51b9ed5d3c9bc1ab431d0a52fe42a990ed"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/macroable/zipball/e1be58f9b2af73f242dc6a9add1f376b3ec89eef",
- "reference": "e1be58f9b2af73f242dc6a9add1f376b3ec89eef",
+ "url": "https://api.github.com/repos/illuminate/macroable/zipball/e1cb9e51b9ed5d3c9bc1ab431d0a52fe42a990ed",
+ "reference": "e1cb9e51b9ed5d3c9bc1ab431d0a52fe42a990ed",
"shasum": ""
},
"require": {
@@ -426,20 +426,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2023-06-08T14:08:27+00:00"
+ "time": "2024-06-28T20:10:30+00:00"
},
{
"name": "illuminate/session",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/session.git",
- "reference": "d9460cefa3736ea98a72bbea0ae02d4ac1e7d8fd"
+ "reference": "b831db344028e665052a4de88fd5590bfa1707c3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/session/zipball/d9460cefa3736ea98a72bbea0ae02d4ac1e7d8fd",
- "reference": "d9460cefa3736ea98a72bbea0ae02d4ac1e7d8fd",
+ "url": "https://api.github.com/repos/illuminate/session/zipball/b831db344028e665052a4de88fd5590bfa1707c3",
+ "reference": "b831db344028e665052a4de88fd5590bfa1707c3",
"shasum": ""
},
"require": {
@@ -483,20 +483,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2024-04-04T17:36:49+00:00"
+ "time": "2024-06-28T20:10:30+00:00"
},
{
"name": "illuminate/support",
- "version": "v11.7.0",
+ "version": "v11.14.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
- "reference": "7d733a1dbeb96557ba287e778bbf7bc61e23c31d"
+ "reference": "a8f299ed76d52fc048decada3571628e65fa5c41"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/support/zipball/7d733a1dbeb96557ba287e778bbf7bc61e23c31d",
- "reference": "7d733a1dbeb96557ba287e778bbf7bc61e23c31d",
+ "url": "https://api.github.com/repos/illuminate/support/zipball/a8f299ed76d52fc048decada3571628e65fa5c41",
+ "reference": "a8f299ed76d52fc048decada3571628e65fa5c41",
"shasum": ""
},
"require": {
@@ -557,20 +557,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2024-05-06T18:30:15+00:00"
+ "time": "2024-07-01T21:58:57+00:00"
},
{
"name": "nesbot/carbon",
- "version": "3.3.1",
+ "version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
- "reference": "8ff64b92c1b1ec84fcde9f8bb9ff2ca34cb8a77a"
+ "reference": "39c8ef752db6865717cc3fba63970c16f057982c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8ff64b92c1b1ec84fcde9f8bb9ff2ca34cb8a77a",
- "reference": "8ff64b92c1b1ec84fcde9f8bb9ff2ca34cb8a77a",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/39c8ef752db6865717cc3fba63970c16f057982c",
+ "reference": "39c8ef752db6865717cc3fba63970c16f057982c",
"shasum": ""
},
"require": {
@@ -588,13 +588,13 @@
"require-dev": {
"doctrine/dbal": "^3.6.3 || ^4.0",
"doctrine/orm": "^2.15.2 || ^3.0",
- "friendsofphp/php-cs-fixer": "^3.52.1",
+ "friendsofphp/php-cs-fixer": "^3.57.2",
"kylekatarnls/multi-tester": "^2.5.3",
"ondrejmirtes/better-reflection": "^6.25.0.4",
"phpmd/phpmd": "^2.15.0",
"phpstan/extension-installer": "^1.3.1",
- "phpstan/phpstan": "^1.10.65",
- "phpunit/phpunit": "^10.5.15",
+ "phpstan/phpstan": "^1.11.2",
+ "phpunit/phpunit": "^10.5.20",
"squizlabs/php_codesniffer": "^3.9.0"
},
"bin": [
@@ -663,7 +663,7 @@
"type": "tidelift"
}
],
- "time": "2024-05-01T06:54:22+00:00"
+ "time": "2024-06-20T15:52:59+00:00"
},
{
"name": "psr/clock",
@@ -819,16 +819,16 @@
},
{
"name": "symfony/clock",
- "version": "v7.0.7",
+ "version": "v7.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/clock.git",
- "reference": "2008671acb4a30b01c453de193cf9c80549ebda6"
+ "reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/clock/zipball/2008671acb4a30b01c453de193cf9c80549ebda6",
- "reference": "2008671acb4a30b01c453de193cf9c80549ebda6",
+ "url": "https://api.github.com/repos/symfony/clock/zipball/3dfc8b084853586de51dd1441c6242c76a28cbe7",
+ "reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7",
"shasum": ""
},
"require": {
@@ -873,7 +873,7 @@
"time"
],
"support": {
- "source": "https://github.com/symfony/clock/tree/v7.0.7"
+ "source": "https://github.com/symfony/clock/tree/v7.1.1"
},
"funding": [
{
@@ -889,20 +889,20 @@
"type": "tidelift"
}
],
- "time": "2024-04-18T09:29:19+00:00"
+ "time": "2024-05-31T14:57:53+00:00"
},
{
"name": "symfony/finder",
- "version": "v7.0.7",
+ "version": "v7.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c"
+ "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/4d58f0f4fe95a30d7b538d71197135483560b97c",
- "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6",
+ "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6",
"shasum": ""
},
"require": {
@@ -937,7 +937,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/finder/tree/v7.0.7"
+ "source": "https://github.com/symfony/finder/tree/v7.1.1"
},
"funding": [
{
@@ -953,20 +953,20 @@
"type": "tidelift"
}
],
- "time": "2024-04-28T11:44:19+00:00"
+ "time": "2024-05-31T14:57:53+00:00"
},
{
"name": "symfony/http-foundation",
- "version": "v7.0.7",
+ "version": "v7.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "0194e064b8bdc29381462f790bab04e1cac8fdc8"
+ "reference": "74d171d5b6a1d9e4bfee09a41937c17a7536acfa"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/0194e064b8bdc29381462f790bab04e1cac8fdc8",
- "reference": "0194e064b8bdc29381462f790bab04e1cac8fdc8",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/74d171d5b6a1d9e4bfee09a41937c17a7536acfa",
+ "reference": "74d171d5b6a1d9e4bfee09a41937c17a7536acfa",
"shasum": ""
},
"require": {
@@ -1014,7 +1014,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/http-foundation/tree/v7.0.7"
+ "source": "https://github.com/symfony/http-foundation/tree/v7.1.1"
},
"funding": [
{
@@ -1030,20 +1030,20 @@
"type": "tidelift"
}
],
- "time": "2024-04-18T09:29:19+00:00"
+ "time": "2024-05-31T14:57:53+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.29.0",
+ "version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
+ "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
- "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c",
+ "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c",
"shasum": ""
},
"require": {
@@ -1094,7 +1094,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0"
},
"funding": [
{
@@ -1110,105 +1110,24 @@
"type": "tidelift"
}
],
- "time": "2024-01-29T20:11:03+00:00"
- },
- {
- "name": "symfony/polyfill-php80",
- "version": "v1.29.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php80.git",
- "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
- "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
- "shasum": ""
- },
- "require": {
- "php": ">=7.1"
- },
- "type": "library",
- "extra": {
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "autoload": {
- "files": [
- "bootstrap.php"
- ],
- "psr-4": {
- "Symfony\\Polyfill\\Php80\\": ""
- },
- "classmap": [
- "Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Ion Bazan",
- "email": "ion.bazan@gmail.com"
- },
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2024-01-29T20:11:03+00:00"
+ "time": "2024-06-19T12:30:46+00:00"
},
{
"name": "symfony/polyfill-php83",
- "version": "v1.29.0",
+ "version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php83.git",
- "reference": "86fcae159633351e5fd145d1c47de6c528f8caff"
+ "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/86fcae159633351e5fd145d1c47de6c528f8caff",
- "reference": "86fcae159633351e5fd145d1c47de6c528f8caff",
+ "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
+ "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
"shasum": ""
},
"require": {
- "php": ">=7.1",
- "symfony/polyfill-php80": "^1.14"
+ "php": ">=7.1"
},
"type": "library",
"extra": {
@@ -1251,7 +1170,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php83/tree/v1.29.0"
+ "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0"
},
"funding": [
{
@@ -1267,20 +1186,20 @@
"type": "tidelift"
}
],
- "time": "2024-01-29T20:11:03+00:00"
+ "time": "2024-06-19T12:35:24+00:00"
},
{
"name": "symfony/translation",
- "version": "v7.0.7",
+ "version": "v7.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
- "reference": "1515e03afaa93e6419aba5d5c9d209159317100b"
+ "reference": "cf5ae136e124fc7681b34ce9fac9d5b9ae8ceee3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/1515e03afaa93e6419aba5d5c9d209159317100b",
- "reference": "1515e03afaa93e6419aba5d5c9d209159317100b",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/cf5ae136e124fc7681b34ce9fac9d5b9ae8ceee3",
+ "reference": "cf5ae136e124fc7681b34ce9fac9d5b9ae8ceee3",
"shasum": ""
},
"require": {
@@ -1345,7 +1264,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/translation/tree/v7.0.7"
+ "source": "https://github.com/symfony/translation/tree/v7.1.1"
},
"funding": [
{
@@ -1361,7 +1280,7 @@
"type": "tidelift"
}
],
- "time": "2024-04-18T09:29:19+00:00"
+ "time": "2024-05-31T14:57:53+00:00"
},
{
"name": "symfony/translation-contracts",
@@ -1653,16 +1572,16 @@
},
{
"name": "myclabs/deep-copy",
- "version": "1.11.1",
+ "version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
- "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
+ "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
- "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
+ "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"shasum": ""
},
"require": {
@@ -1670,11 +1589,12 @@
},
"conflict": {
"doctrine/collections": "<1.6.8",
- "doctrine/common": "<2.13.3 || >=3,<3.2.2"
+ "doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
+ "phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
@@ -1700,7 +1620,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
- "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
},
"funding": [
{
@@ -1708,20 +1628,20 @@
"type": "tidelift"
}
],
- "time": "2023-03-08T13:26:56+00:00"
+ "time": "2024-06-12T14:39:25+00:00"
},
{
"name": "nikic/php-parser",
- "version": "v5.0.2",
+ "version": "v5.1.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13"
+ "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13",
- "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1",
+ "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1",
"shasum": ""
},
"require": {
@@ -1732,7 +1652,7 @@
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
- "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
+ "phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
@@ -1764,9 +1684,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
- "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2"
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0"
},
- "time": "2024-03-05T20:51:40+00:00"
+ "time": "2024-07-01T20:03:41+00:00"
},
{
"name": "phar-io/manifest",
@@ -1888,16 +1808,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "10.1.14",
+ "version": "10.1.15",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b"
+ "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b",
- "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae",
+ "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae",
"shasum": ""
},
"require": {
@@ -1954,7 +1874,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15"
},
"funding": [
{
@@ -1962,7 +1882,7 @@
"type": "github"
}
],
- "time": "2024-03-12T15:33:41+00:00"
+ "time": "2024-06-29T08:25:15+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -2209,16 +2129,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "10.5.20",
+ "version": "10.5.25",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3"
+ "reference": "831bf82312be6037e811833ddbea0b8de60ea314"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3",
- "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/831bf82312be6037e811833ddbea0b8de60ea314",
+ "reference": "831bf82312be6037e811833ddbea0b8de60ea314",
"shasum": ""
},
"require": {
@@ -2290,7 +2210,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.25"
},
"funding": [
{
@@ -2306,7 +2226,7 @@
"type": "tidelift"
}
],
- "time": "2024-04-24T06:32:35+00:00"
+ "time": "2024-07-03T05:49:17+00:00"
},
{
"name": "roave/security-advisories",
@@ -2314,12 +2234,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
- "reference": "5a190e68aef110a461c04c09b148660a377da4db"
+ "reference": "fed98f59fae0ca97a0753263270f4a8680d09f03"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5a190e68aef110a461c04c09b148660a377da4db",
- "reference": "5a190e68aef110a461c04c09b148660a377da4db",
+ "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fed98f59fae0ca97a0753263270f4a8680d09f03",
+ "reference": "fed98f59fae0ca97a0753263270f4a8680d09f03",
"shasum": ""
},
"conflict": {
@@ -2327,6 +2247,10 @@
"admidio/admidio": "<4.2.13",
"adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3",
"aheinze/cockpit": "<2.2",
+ "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.04.6",
+ "aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1",
+ "aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7",
+ "aimeos/aimeos-core": ">=2022.04.1,<2022.10.17|>=2023.04.1,<2023.10.17|>=2024.04.1,<2024.04.7",
"aimeos/aimeos-typo3": "<19.10.12|>=20,<20.10.5",
"airesvsg/acf-to-rest-api": "<=3.1",
"akaunting/akaunting": "<2.1.13",
@@ -2377,6 +2301,7 @@
"bmarshall511/wordpress_zero_spam": "<5.2.13",
"bolt/bolt": "<3.7.2",
"bolt/core": "<=4.2",
+ "born05/craft-twofactorauthentication": "<3.3.4",
"bottelet/flarepoint": "<2.2.1",
"bref/bref": "<2.1.17",
"brightlocal/phpwhois": "<=4.2.5",
@@ -2408,7 +2333,7 @@
"codeigniter4/framework": "<4.4.7",
"codeigniter4/shield": "<1.0.0.0-beta8",
"codiad/codiad": "<=2.8.4",
- "composer/composer": "<1.10.27|>=2,<2.2.23|>=2.3,<2.7",
+ "composer/composer": "<1.10.27|>=2,<2.2.24|>=2.3,<2.7.7",
"concrete5/concrete5": "<9.2.8",
"concrete5/core": "<8.5.8|>=9,<9.1",
"contao-components/mediaelement": ">=2.14.2,<2.21.1",
@@ -2445,7 +2370,7 @@
"doctrine/mongodb-odm": "<1.0.2",
"doctrine/mongodb-odm-bundle": "<3.0.1",
"doctrine/orm": ">=1,<1.2.4|>=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4",
- "dolibarr/dolibarr": "<=19",
+ "dolibarr/dolibarr": "<19.0.2",
"dompdf/dompdf": "<2.0.4",
"doublethreedigital/guest-entries": "<3.1.2",
"drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<10.1.8|>=10.2,<10.2.2",
@@ -2528,6 +2453,7 @@
"funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3",
"gaoming13/wechat-php-sdk": "<=1.10.2",
"genix/cms": "<=1.1.11",
+ "getformwork/formwork": "<1.13.1|==2.0.0.0-beta1",
"getgrav/grav": "<1.7.46",
"getkirby/cms": "<4.1.1",
"getkirby/kirby": "<=2.5.12",
@@ -2541,7 +2467,7 @@
"gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3",
"gree/jose": "<2.2.1",
"gregwar/rst": "<1.0.3",
- "grumpydictator/firefly-iii": "<6.1.7",
+ "grumpydictator/firefly-iii": "<6.1.17",
"gugoan/economizzer": "<=0.9.0.0-beta1",
"guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5",
"guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5",
@@ -2598,6 +2524,7 @@
"jsdecena/laracom": "<2.0.9",
"jsmitty12/phpwhois": "<5.1",
"juzaweb/cms": "<=3.4",
+ "jweiland/events2": "<8.3.8|>=9,<9.0.6",
"kazist/phpwhois": "<=4.2.6",
"kelvinmo/simplexrd": "<3.1.1",
"kevinpapst/kimai2": "<1.16.7",
@@ -2635,7 +2562,7 @@
"lms/routes": "<2.1.1",
"localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2",
"luyadev/yii-helpers": "<1.2.1",
- "magento/community-edition": "<2.4.3.0-patch3|>=2.4.4,<2.4.5",
+ "magento/community-edition": "<2.4.5|==2.4.5|>=2.4.5.0-patch1,<2.4.5.0-patch8|==2.4.6|>=2.4.6.0-patch1,<2.4.6.0-patch6|==2.4.7",
"magento/core": "<=1.9.4.5",
"magento/magento1ce": "<1.9.4.3-dev",
"magento/magento1ee": ">=1,<1.14.4.3-dev",
@@ -2668,7 +2595,7 @@
"mojo42/jirafeau": "<4.4",
"mongodb/mongodb": ">=1,<1.9.2",
"monolog/monolog": ">=1.8,<1.12",
- "moodle/moodle": "<=4.3.3",
+ "moodle/moodle": "<4.3.5|>=4.4.0.0-beta,<4.4.1",
"mos/cimage": "<0.7.19",
"movim/moxl": ">=0.8,<=0.10",
"movingbytes/social-network": "<=1.2.1",
@@ -2705,12 +2632,12 @@
"october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1",
"october/october": "<=3.4.4",
"october/rain": "<1.0.472|>=1.1,<1.1.2",
- "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.2",
+ "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.15",
"omeka/omeka-s": "<4.0.3",
"onelogin/php-saml": "<2.10.4",
"oneup/uploader-bundle": ">=1,<1.9.3|>=2,<2.1.5",
"open-web-analytics/open-web-analytics": "<1.7.4",
- "opencart/opencart": "<=3.0.3.7|>=4,<4.0.2.3-dev",
+ "opencart/opencart": "<=3.0.3.9|>=4",
"openid/php-openid": "<2.3",
"openmage/magento-lts": "<20.5",
"opensolutions/vimbadmin": "<=3.0.15",
@@ -2763,13 +2690,13 @@
"phpxmlrpc/extras": "<0.6.1",
"phpxmlrpc/phpxmlrpc": "<4.9.2",
"pi/pi": "<=2.5",
- "pimcore/admin-ui-classic-bundle": "<1.3.4",
+ "pimcore/admin-ui-classic-bundle": "<=1.4.2",
"pimcore/customer-management-framework-bundle": "<4.0.6",
"pimcore/data-hub": "<1.2.4",
"pimcore/demo": "<10.3",
"pimcore/ecommerce-framework-bundle": "<1.0.10",
"pimcore/perspective-editor": "<1.5.1",
- "pimcore/pimcore": "<11.1.6.5-dev|>=11.2,<11.2.3",
+ "pimcore/pimcore": "<11.2.4",
"pixelfed/pixelfed": "<0.11.11",
"plotly/plotly.js": "<2.25.2",
"pocketmine/bedrock-protocol": "<8.0.2",
@@ -2834,7 +2761,7 @@
"silverstripe/admin": "<1.13.19|>=2,<2.1.8",
"silverstripe/assets": ">=1,<1.11.1",
"silverstripe/cms": "<4.11.3",
- "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1",
+ "silverstripe/comments": ">=1.3,<3.1.1",
"silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3",
"silverstripe/framework": "<4.13.39|>=5,<5.1.11",
"silverstripe/graphql": ">=2,<2.0.5|>=3,<3.8.2|>=4,<4.3.7|>=5,<5.1.3",
@@ -2860,8 +2787,8 @@
"slim/psr7": "<1.4.1|>=1.5,<1.5.1|>=1.6,<1.6.1",
"slim/slim": "<2.6",
"slub/slub-events": "<3.0.3",
- "smarty/smarty": "<3.1.48|>=4,<4.3.1",
- "snipe/snipe-it": "<=6.2.2",
+ "smarty/smarty": "<4.5.3|>=5,<5.1.1",
+ "snipe/snipe-it": "<6.4.2",
"socalnick/scn-social-auth": "<1.15.2",
"socialiteproviders/steam": "<1.1",
"spatie/browsershot": "<3.57.4",
@@ -2871,11 +2798,13 @@
"spoonity/tcpdf": "<6.2.22",
"squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1",
"ssddanbrown/bookstack": "<22.02.3",
- "statamic/cms": "<4.46",
+ "statamic/cms": "<4.46|>=5.3,<5.6.2",
"stormpath/sdk": "<9.9.99",
"studio-42/elfinder": "<2.1.62",
+ "studiomitte/friendlycaptcha": "<0.1.4",
"subhh/libconnect": "<7.0.8|>=8,<8.1",
"sukohi/surpass": "<1",
+ "sulu/form-bundle": ">=2,<2.5.3",
"sulu/sulu": "<1.6.44|>=2,<2.4.17|>=2.5,<2.5.13",
"sumocoders/framework-user-bundle": "<1.4",
"superbig/craft-audit": "<3.0.2",
@@ -2888,7 +2817,7 @@
"sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1",
"sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4",
"sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2|>=1.12.0.0-alpha1,<1.12.16|>=1.13.0.0-alpha1,<1.13.1",
- "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99",
+ "symbiote/silverstripe-multivaluefield": ">=3,<3.1",
"symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4",
"symbiote/silverstripe-seed": "<6.0.3",
"symbiote/silverstripe-versionedfiles": "<=2.0.3",
@@ -2939,7 +2868,7 @@
"thorsten/phpmyfaq": "<3.2.2",
"tikiwiki/tiki-manager": "<=17.1",
"timber/timber": ">=0.16.6,<1.23.1|>=1.24,<1.24.1|>=2,<2.1",
- "tinymce/tinymce": "<7",
+ "tinymce/tinymce": "<7.2",
"tinymighty/wiki-seo": "<1.2.2",
"titon/framework": "<9.9.99",
"tobiasbg/tablepress": "<=2.0.0.0-RC1",
@@ -2976,12 +2905,14 @@
"uvdesk/core-framework": "<=1.1.1",
"vanilla/safecurl": "<0.9.2",
"verbb/comments": "<1.5.5",
+ "verbb/formie": "<2.1.6",
"verbb/image-resizer": "<2.0.9",
"verbb/knock-knock": "<1.2.8",
"verot/class.upload.php": "<=2.1.6",
"villagedefrance/opencart-overclocked": "<=1.11.1",
"vova07/yii2-fileapi-widget": "<0.1.9",
"vrana/adminer": "<4.8.1",
+ "vufind/vufind": ">=2,<9.1.1",
"waldhacker/hcaptcha": "<2.1.2",
"wallabag/tcpdf": "<6.2.22",
"wallabag/wallabag": "<2.6.7",
@@ -3000,14 +2931,14 @@
"winter/wn-dusk-plugin": "<2.1",
"winter/wn-system-module": "<1.2.4",
"wintercms/winter": "<=1.2.3",
- "woocommerce/woocommerce": "<6.6",
+ "woocommerce/woocommerce": "<6.6|>=8.8,<8.8.5|>=8.9,<8.9.3",
"wp-cli/wp-cli": ">=0.12,<2.5",
"wp-graphql/wp-graphql": "<=1.14.5",
"wp-premium/gravityforms": "<2.4.21",
"wpanel/wpanel4-cms": "<=4.3.1",
"wpcloud/wp-stateless": "<3.2",
"wpglobus/wpglobus": "<=1.9.6",
- "wwbn/avideo": "<=12.4",
+ "wwbn/avideo": "<14.3",
"xataface/xataface": "<3",
"xpressengine/xpressengine": "<3.0.15",
"yab/quarx": "<2.4.5",
@@ -3016,7 +2947,7 @@
"yidashi/yii2cmf": "<=2",
"yii2mod/yii2-cms": "<1.9.2",
"yiisoft/yii": "<1.1.29",
- "yiisoft/yii2": "<2.0.38",
+ "yiisoft/yii2": "<2.0.50",
"yiisoft/yii2-authclient": "<2.2.15",
"yiisoft/yii2-bootstrap": "<2.0.4",
"yiisoft/yii2-dev": "<2.0.43",
@@ -3043,7 +2974,7 @@
"zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3",
"zendframework/zend-mail": "<2.4.11|>=2.5,<2.7.2",
"zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1",
- "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4",
+ "zendframework/zend-session": ">=2,<2.2.9|>=2.3,<2.3.4",
"zendframework/zend-validator": ">=2.3,<2.3.6",
"zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1",
"zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6",
@@ -3102,7 +3033,7 @@
"type": "tidelift"
}
],
- "time": "2024-05-20T05:04:57+00:00"
+ "time": "2024-07-02T22:05:16+00:00"
},
{
"name": "sebastian/cli-parser",
diff --git a/src/Notifier.php b/src/Notifier.php
index 0c45672..c76e1b5 100644
--- a/src/Notifier.php
+++ b/src/Notifier.php
@@ -31,14 +31,14 @@ class Notifier
/**
* Illuminate Session
*
- * @var \Illuminate\Session\SessionManager
+ * @var SessionManager
*/
protected $session;
/**
* Constructor
*
- * @param \Illuminate\Session\SessionManager $session
+ * @param SessionManager $session
*
* @internal param \Illuminate\Session\SessionManager $session
*/
@@ -158,14 +158,15 @@ public function render(): string
/**
* Add a notification
*
+ * @param $theme
+ * @param $timeout
* @param string $type Could be error, info, success, or warning.
- * @param string $text The notification's message
- * @param string $title The notification's title
- * @param array $options
- * @param bool $onlyNextRequest if true(default), se the notification in session only for the next request
- *
+ * @param $layout
+ * @param string $text notification's message
+ * @param null $sounds
+ * @param null $soundsVolume
*/
- public function add($theme, $timeout, $type, $layout, $text, $sounds = null, $soundsVolume = null)
+ public function add($theme, $timeout, $type, $layout, $text, $sounds = null, $soundsVolume = null): void
{
if ($type == '') {
$type = 'info';
@@ -185,14 +186,14 @@ public function add($theme, $timeout, $type, $layout, $text, $sounds = null, $so
if ($sounds !== null) {
$notification['sources'] = [
'sounds' => [$sounds],
- 'soundsVolume' => $soundsVolume !== null ? $soundsVolume : 0.5,
+ 'soundsVolume' => $soundsVolume ?? 0.5,
];
}
$this->notifications[] = $notification;
}
- public function addForNextRequest($theme, $timeout, $type, $layout, $text, $sounds = null, $soundsVolume = null)
+ public function addForNextRequest($theme, $timeout, $type, $layout, $text, $sounds = null, $soundsVolume = null): void
{
if ($type == '') {
$type = 'info';
@@ -212,7 +213,7 @@ public function addForNextRequest($theme, $timeout, $type, $layout, $text, $soun
if ($sounds !== null) {
$notification['sources'] = [
'sounds' => [$sounds],
- 'soundsVolume' => $soundsVolume !== null ? $soundsVolume : 0.5,
+ 'soundsVolume' => $soundsVolume ?? 0.5,
];
}
@@ -226,14 +227,27 @@ public function addForNextRequest($theme, $timeout, $type, $layout, $text, $soun
$this->session->flash('laravel::flash-notifications', $flashNotifications);
}
+ /**
+ * Shortcut for adding an info notification with condition
+ *
+ * @param bool $condition
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
+ * @param array $options
+ */
+ public function ifInfo(bool $condition, $text, bool $onlyNextRequest = false, array $options = []): void
+ {
+ $this->info($text, $onlyNextRequest, $options);
+ }
+
/**
* Shortcut for adding an info notification
*
- * @param string $message The notification's message
- * @param string $title The notification's title
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
* @param array $options
*/
- public function info($text, $onlyNextRequest = false, array $options = [])
+ public function info($text, bool $onlyNextRequest = false, array $options = []): void
{
$theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
$timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : false;
@@ -245,14 +259,27 @@ public function info($text, $onlyNextRequest = false, array $options = [])
$this->add($theme, $timeout, 'info', $layout, $text, null, null);
}
+ /**
+ * Shortcut for adding an error notification with condition
+ *
+ * @param bool $condition
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
+ * @param array $options
+ */
+ public function ifError(bool $condition, $text, bool $onlyNextRequest = false, array $options = []): void
+ {
+ $this->error($text, $onlyNextRequest, $options);
+ }
+
/**
* Shortcut for adding an error notification
*
- * @param string $message The notification's message
- * @param string $title The notification's title
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
* @param array $options
*/
- public function error($text, $onlyNextRequest = false, array $options = [])
+ public function error($text, bool $onlyNextRequest = false, array $options = []): void
{
$theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
$timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : 0;
@@ -264,14 +291,27 @@ public function error($text, $onlyNextRequest = false, array $options = [])
$this->add($theme, $timeout, 'error', $layout, $text, null, null, $onlyNextRequest);
}
+ /**
+ * Shortcut for adding a warning notification with condition
+ *
+ * @param bool $condition
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
+ * @param array $options
+ */
+ public function ifWarning(bool $condition, $text, bool $onlyNextRequest = false, array $options = []): void
+ {
+ $this->warning($text, $onlyNextRequest, $options);
+ }
+
/**
* Shortcut for adding a warning notification
*
- * @param string $message The notification's message
- * @param string $title The notification's title
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
* @param array $options
*/
- public function warning($text, $onlyNextRequest = false, array $options = [])
+ public function warning($text, bool $onlyNextRequest = false, array $options = []): void
{
$theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
$timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : 0;
@@ -283,14 +323,27 @@ public function warning($text, $onlyNextRequest = false, array $options = [])
$this->add($theme, $timeout, 'warning', $layout, $text, null, null, $onlyNextRequest);
}
+ /**
+ * Shortcut for adding a success notification with condition
+ *
+ * @param bool $condition
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
+ * @param array $options
+ */
+ public function ifSuccess(bool $condition, $text, bool $onlyNextRequest = false, array $options = []): void
+ {
+ $this->success($text, $onlyNextRequest, $options);
+ }
+
/**
* Shortcut for adding a success notification
*
- * @param string $message The notification's message
- * @param string $title The notification's title
+ * @param $text notification's message
+ * @param bool $onlyNextRequest
* @param array $options
*/
- public function success($text, $onlyNextRequest = false, array $options = [])
+ public function success($text, $onlyNextRequest = false, array $options = []): void
{
$theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
$timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : 0;
@@ -306,29 +359,38 @@ public function success($text, $onlyNextRequest = false, array $options = [])
/**
* Clear all notifications
*
- * @param bool $withSession if true (default) clean notifications in session too.
*/
- public function clear()
+ public function clear(): void
{
$this->notifications = [];
}
- public function clearFlashed(bool $withSession = true)
+ /**
+ * @param bool $withSession
+ * @return void
+ */
+ public function clearFlashed(bool $withSession = true): void
{
$this->flashedNotifications = [];
- if ($withSession) {
- $this->session->forget('laravel::flash-notifications');
+ if (!$withSession) {
+ return;
}
+ $this->session->forget('laravel::flash-notifications');
}
- public function clearAll(bool $withSession = true)
+ /**
+ * @param bool $withSession
+ * @return void
+ */
+ public function clearAll(bool $withSession = true): void
{
$this->notifications = [];
$this->flashedNotifications = [];
- if ($withSession) {
- $this->session->forget('laravel::flash-notifications');
+ if (!$withSession) {
+ return;
}
+ $this->session->forget('laravel::flash-notifications');
}
}