From 92f2bc4f10565f6b2c6e84b3707b00dda80821bf Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 19 Jun 2024 23:46:58 +0300 Subject: [PATCH 1/4] prevent delete if the form or response is linked to Extension --- composer.lock | 342 ++++++++++++++++++------------------ src/Contracts/Extension.php | 11 ++ src/Models/Form.php | 40 +++-- src/Models/Response.php | 12 ++ 4 files changed, 216 insertions(+), 189 deletions(-) diff --git a/composer.lock b/composer.lock index 3a191317..07564281 100644 --- a/composer.lock +++ b/composer.lock @@ -881,16 +881,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.5", + "version": "3.8.6", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "0e3536ba088a749985c8801105b6b3ac6c1280b6" + "reference": "b7411825cf7efb7e51f9791dea19d86e43b399a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/0e3536ba088a749985c8801105b6b3ac6c1280b6", - "reference": "0e3536ba088a749985c8801105b6b3ac6c1280b6", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/b7411825cf7efb7e51f9791dea19d86e43b399a1", + "reference": "b7411825cf7efb7e51f9791dea19d86e43b399a1", "shasum": "" }, "require": { @@ -906,12 +906,12 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.11.1", + "phpstan/phpstan": "1.11.5", "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpunit": "9.6.19", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.9.2", + "squizlabs/php_codesniffer": "3.10.1", "symfony/cache": "^5.4|^6.0|^7.0", "symfony/console": "^4.4|^5.4|^6.0|^7.0", "vimeo/psalm": "4.30.0" @@ -974,7 +974,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.5" + "source": "https://github.com/doctrine/dbal/tree/3.8.6" }, "funding": [ { @@ -990,7 +990,7 @@ "type": "tidelift" } ], - "time": "2024-06-08T17:49:56+00:00" + "time": "2024-06-19T10:38:17+00:00" }, { "name": "doctrine/deprecations", @@ -1428,16 +1428,16 @@ }, { "name": "filament/actions", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/actions.git", - "reference": "37f50638b0dd7f9bb2de2139a8391bd1216700da" + "reference": "c8488bd6c5488818788a41c88c5c1cd0f6f7cb78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/actions/zipball/37f50638b0dd7f9bb2de2139a8391bd1216700da", - "reference": "37f50638b0dd7f9bb2de2139a8391bd1216700da", + "url": "https://api.github.com/repos/filamentphp/actions/zipball/c8488bd6c5488818788a41c88c5c1cd0f6f7cb78", + "reference": "c8488bd6c5488818788a41c88c5c1cd0f6f7cb78", "shasum": "" }, "require": { @@ -1477,20 +1477,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-06-13T07:03:59+00:00" + "time": "2024-06-18T06:31:25+00:00" }, { "name": "filament/filament", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/panels.git", - "reference": "9174bb8d374919ff01e515fa824a025dd7e7401d" + "reference": "04c7626d81180715a9b9e03f566a5ca66e0b4e51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/panels/zipball/9174bb8d374919ff01e515fa824a025dd7e7401d", - "reference": "9174bb8d374919ff01e515fa824a025dd7e7401d", + "url": "https://api.github.com/repos/filamentphp/panels/zipball/04c7626d81180715a9b9e03f566a5ca66e0b4e51", + "reference": "04c7626d81180715a9b9e03f566a5ca66e0b4e51", "shasum": "" }, "require": { @@ -1542,20 +1542,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-06-13T07:48:11+00:00" + "time": "2024-06-18T06:31:31+00:00" }, { "name": "filament/forms", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "fbdd499b7432a756793f2abb2c18f2e22dc1b669" + "reference": "76e8fe7fe8b20f9818aa91d022338575207f03ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/fbdd499b7432a756793f2abb2c18f2e22dc1b669", - "reference": "fbdd499b7432a756793f2abb2c18f2e22dc1b669", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/76e8fe7fe8b20f9818aa91d022338575207f03ea", + "reference": "76e8fe7fe8b20f9818aa91d022338575207f03ea", "shasum": "" }, "require": { @@ -1598,11 +1598,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-06-13T07:03:58+00:00" + "time": "2024-06-18T06:31:19+00:00" }, { "name": "filament/infolists", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/infolists.git", @@ -1653,7 +1653,7 @@ }, { "name": "filament/notifications", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", @@ -1705,7 +1705,7 @@ }, { "name": "filament/spatie-laravel-translatable-plugin", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-translatable-plugin.git", @@ -1750,16 +1750,16 @@ }, { "name": "filament/support", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", - "reference": "5a4394d1bc9fde801a170141b3842a84b58c1336" + "reference": "852ec3783349d799141c302a4944d5303ece985d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/support/zipball/5a4394d1bc9fde801a170141b3842a84b58c1336", - "reference": "5a4394d1bc9fde801a170141b3842a84b58c1336", + "url": "https://api.github.com/repos/filamentphp/support/zipball/852ec3783349d799141c302a4944d5303ece985d", + "reference": "852ec3783349d799141c302a4944d5303ece985d", "shasum": "" }, "require": { @@ -1804,11 +1804,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-06-13T07:48:21+00:00" + "time": "2024-06-14T10:24:22+00:00" }, { "name": "filament/tables", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", @@ -1861,7 +1861,7 @@ }, { "name": "filament/widgets", - "version": "v3.2.90", + "version": "v3.2.92", "source": { "type": "git", "url": "https://github.com/filamentphp/widgets.git", @@ -2576,16 +2576,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.12", + "version": "v10.48.13", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "590afea38e708022662629fbf5184351fa82cf08" + "reference": "2c6816d697a4362c09c066118addda251b70b98a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/590afea38e708022662629fbf5184351fa82cf08", - "reference": "590afea38e708022662629fbf5184351fa82cf08", + "url": "https://api.github.com/repos/laravel/framework/zipball/2c6816d697a4362c09c066118addda251b70b98a", + "reference": "2c6816d697a4362c09c066118addda251b70b98a", "shasum": "" }, "require": { @@ -2779,20 +2779,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-05-28T15:46:19+00:00" + "time": "2024-06-18T16:46:35+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -2835,9 +2835,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/serializable-closure", @@ -3539,16 +3539,16 @@ }, { "name": "livewire/livewire", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "72e900825c560f0e4e620185b26c5441a8914435" + "reference": "da044261bb5c5449397f18fda3409f14acf47c0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/72e900825c560f0e4e620185b26c5441a8914435", - "reference": "72e900825c560f0e4e620185b26c5441a8914435", + "url": "https://api.github.com/repos/livewire/livewire/zipball/da044261bb5c5449397f18fda3409f14acf47c0a", + "reference": "da044261bb5c5449397f18fda3409f14acf47c0a", "shasum": "" }, "require": { @@ -3603,7 +3603,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.5.0" + "source": "https://github.com/livewire/livewire/tree/v3.5.1" }, "funding": [ { @@ -3611,7 +3611,7 @@ "type": "github" } ], - "time": "2024-05-21T13:39:04+00:00" + "time": "2024-06-18T11:10:42+00:00" }, { "name": "masterminds/html5", @@ -4124,16 +4124,16 @@ }, { "name": "openspout/openspout", - "version": "v4.24.1", + "version": "v4.24.2", "source": { "type": "git", "url": "https://github.com/openspout/openspout.git", - "reference": "003991abc5cfee93423254774c71766d38cbe340" + "reference": "24272c1f7d073cc64fa3ecc2a863dc5d13be33a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/openspout/openspout/zipball/003991abc5cfee93423254774c71766d38cbe340", - "reference": "003991abc5cfee93423254774c71766d38cbe340", + "url": "https://api.github.com/repos/openspout/openspout/zipball/24272c1f7d073cc64fa3ecc2a863dc5d13be33a8", + "reference": "24272c1f7d073cc64fa3ecc2a863dc5d13be33a8", "shasum": "" }, "require": { @@ -4147,13 +4147,13 @@ }, "require-dev": { "ext-zlib": "*", - "friendsofphp/php-cs-fixer": "^3.57.1", - "infection/infection": "^0.28.1", + "friendsofphp/php-cs-fixer": "^3.59.3", + "infection/infection": "^0.29.5", "phpbench/phpbench": "^1.2.15", - "phpstan/phpstan": "^1.11.1", + "phpstan/phpstan": "^1.11.4", "phpstan/phpstan-phpunit": "^1.4.0", "phpstan/phpstan-strict-rules": "^1.6.0", - "phpunit/phpunit": "^10.5.20" + "phpunit/phpunit": "^10.5.20 || ^11.2.2" }, "suggest": { "ext-iconv": "To handle non UTF-8 CSV files (if \"php-mbstring\" is not already installed or is too limited)", @@ -4201,7 +4201,7 @@ ], "support": { "issues": "https://github.com/openspout/openspout/issues", - "source": "https://github.com/openspout/openspout/tree/v4.24.1" + "source": "https://github.com/openspout/openspout/tree/v4.24.2" }, "funding": [ { @@ -4213,7 +4213,7 @@ "type": "github" } ], - "time": "2024-05-20T09:32:59+00:00" + "time": "2024-06-17T08:53:37+00:00" }, { "name": "phpoption/phpoption", @@ -6228,16 +6228,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -6287,7 +6287,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -6303,20 +6303,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -6365,7 +6365,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -6381,20 +6381,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a287ed7475f85bf6f61890146edbc932c0fff919" + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a287ed7475f85bf6f61890146edbc932c0fff919", - "reference": "a287ed7475f85bf6f61890146edbc932c0fff919", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", "shasum": "" }, "require": { @@ -6449,7 +6449,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0" }, "funding": [ { @@ -6465,20 +6465,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -6530,7 +6530,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -6546,20 +6546,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+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": { @@ -6610,7 +6610,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": [ { @@ -6626,20 +6626,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" + "reference": "10112722600777e02d2745716b70c5db4ca70442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", + "reference": "10112722600777e02d2745716b70c5db4ca70442", "shasum": "" }, "require": { @@ -6683,7 +6683,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" }, "funding": [ { @@ -6699,20 +6699,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -6763,7 +6763,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -6779,25 +6779,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+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": { @@ -6840,7 +6839,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": [ { @@ -6856,20 +6855,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:35:24+00:00" }, { "name": "symfony/polyfill-uuid", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "3abdd21b0ceaa3000ee950097bc3cf9efc137853" + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/3abdd21b0ceaa3000ee950097bc3cf9efc137853", - "reference": "3abdd21b0ceaa3000ee950097bc3cf9efc137853", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9", + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9", "shasum": "" }, "require": { @@ -6919,7 +6918,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0" }, "funding": [ { @@ -6935,7 +6934,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/process", @@ -8617,16 +8616,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.58.1", + "version": "v3.59.3", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "04e9424025677a86914b9a4944dbbf4060bb0aff" + "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/04e9424025677a86914b9a4944dbbf4060bb0aff", - "reference": "04e9424025677a86914b9a4944dbbf4060bb0aff", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", "shasum": "" }, "require": { @@ -8656,16 +8655,16 @@ "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "facile-it/paraunit": "^1.3 || ^2.0", - "infection/infection": "^0.27.11", + "facile-it/paraunit": "^1.3 || ^2.3", + "infection/infection": "^0.29.5", "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^2.1", "mikey179/vfsstream": "^1.6.11", "php-coveralls/php-coveralls": "^2.7", "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", - "phpunit/phpunit": "^9.6 || ^10.5.5 || ^11.0.2", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.19 || ^10.5.21 || ^11.2", "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, @@ -8680,7 +8679,10 @@ "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -8705,7 +8707,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.58.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" }, "funding": [ { @@ -8713,7 +8715,7 @@ "type": "github" } ], - "time": "2024-05-29T16:39:07+00:00" + "time": "2024-06-16T14:17:03+00:00" }, { "name": "guzzlehttp/psr7", @@ -9013,16 +9015,16 @@ }, { "name": "laravel/pint", - "version": "v1.16.0", + "version": "v1.16.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98" + "reference": "9266a47f1b9231b83e0cfd849009547329d871b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", - "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", + "url": "https://api.github.com/repos/laravel/pint/zipball/9266a47f1b9231b83e0cfd849009547329d871b1", + "reference": "9266a47f1b9231b83e0cfd849009547329d871b1", "shasum": "" }, "require": { @@ -9033,13 +9035,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.57.1", - "illuminate/view": "^10.48.10", - "larastan/larastan": "^2.9.6", + "friendsofphp/php-cs-fixer": "^3.59.3", + "illuminate/view": "^10.48.12", + "larastan/larastan": "^2.9.7", "laravel-zero/framework": "^10.4.0", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.34.7" + "pestphp/pest": "^2.34.8" }, "bin": [ "builds/pint" @@ -9075,7 +9077,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-05-21T18:08:25+00:00" + "time": "2024-06-18T16:50:05+00:00" }, { "name": "laravel/tinker", @@ -9733,16 +9735,16 @@ }, { "name": "orchestra/canvas", - "version": "v8.11.8", + "version": "v8.11.9", "source": { "type": "git", "url": "https://github.com/orchestral/canvas.git", - "reference": "31b1f338fb9d2f3c97ccbc62b27d3e5bf86a02e5" + "reference": "9bed1ce6084af2ce166e9ea1cb160ff22dc94a6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/canvas/zipball/31b1f338fb9d2f3c97ccbc62b27d3e5bf86a02e5", - "reference": "31b1f338fb9d2f3c97ccbc62b27d3e5bf86a02e5", + "url": "https://api.github.com/repos/orchestral/canvas/zipball/9bed1ce6084af2ce166e9ea1cb160ff22dc94a6d", + "reference": "9bed1ce6084af2ce166e9ea1cb160ff22dc94a6d", "shasum": "" }, "require": { @@ -9762,7 +9764,7 @@ "laravel/framework": "^10.48.4", "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", - "phpstan/phpstan": "^1.10.56", + "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^10.5", "spatie/laravel-ray": "^1.33" }, @@ -9802,9 +9804,9 @@ "description": "Code Generators for Laravel Applications and Packages", "support": { "issues": "https://github.com/orchestral/canvas/issues", - "source": "https://github.com/orchestral/canvas/tree/v8.11.8" + "source": "https://github.com/orchestral/canvas/tree/v8.11.9" }, - "time": "2024-03-21T14:41:18+00:00" + "time": "2024-06-18T08:26:09+00:00" }, { "name": "orchestra/canvas-core", @@ -11020,16 +11022,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.4", + "version": "1.11.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" + "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", - "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", + "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", "shasum": "" }, "require": { @@ -11074,7 +11076,7 @@ "type": "github" } ], - "time": "2024-06-06T12:19:22+00:00" + "time": "2024-06-17T15:10:54+00:00" }, { "name": "phpunit/php-code-coverage", @@ -11827,28 +11829,28 @@ }, { "name": "react/dns", - "version": "v1.12.0", + "version": "v1.13.0", "source": { "type": "git", "url": "https://github.com/reactphp/dns.git", - "reference": "c134600642fa615b46b41237ef243daa65bb64ec" + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/dns/zipball/c134600642fa615b46b41237ef243daa65bb64ec", - "reference": "c134600642fa615b46b41237ef243daa65bb64ec", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", "shasum": "" }, "require": { "php": ">=5.3.0", "react/cache": "^1.0 || ^0.6 || ^0.5", "react/event-loop": "^1.2", - "react/promise": "^3.0 || ^2.7 || ^1.2.1" + "react/promise": "^3.2 || ^2.7 || ^1.2.1" }, "require-dev": { "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4 || ^3 || ^2", - "react/promise-timer": "^1.9" + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" }, "type": "library", "autoload": { @@ -11891,7 +11893,7 @@ ], "support": { "issues": "https://github.com/reactphp/dns/issues", - "source": "https://github.com/reactphp/dns/tree/v1.12.0" + "source": "https://github.com/reactphp/dns/tree/v1.13.0" }, "funding": [ { @@ -11899,7 +11901,7 @@ "type": "open_collective" } ], - "time": "2023-11-29T12:41:06+00:00" + "time": "2024-06-13T14:18:03+00:00" }, { "name": "react/event-loop", @@ -14089,16 +14091,16 @@ }, { "name": "symfony/polyfill-iconv", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "cd4226d140ecd3d0f13d32ed0a4a095ffe871d2f" + "reference": "c027e6a3c6aee334663ec21f5852e89738abc805" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/cd4226d140ecd3d0f13d32ed0a4a095ffe871d2f", - "reference": "cd4226d140ecd3d0f13d32ed0a4a095ffe871d2f", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/c027e6a3c6aee334663ec21f5852e89738abc805", + "reference": "c027e6a3c6aee334663ec21f5852e89738abc805", "shasum": "" }, "require": { @@ -14149,7 +14151,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.30.0" }, "funding": [ { @@ -14165,20 +14167,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d" + "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/c565ad1e63f30e7477fc40738343c62b40bc672d", - "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", + "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", "shasum": "" }, "require": { @@ -14225,7 +14227,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" }, "funding": [ { @@ -14241,7 +14243,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/stopwatch", diff --git a/src/Contracts/Extension.php b/src/Contracts/Extension.php index d03d686a..94193064 100644 --- a/src/Contracts/Extension.php +++ b/src/Contracts/Extension.php @@ -3,6 +3,7 @@ namespace LaraZeus\Bolt\Contracts; use LaraZeus\Bolt\Models\Form; +use LaraZeus\Bolt\Models\Response; interface Extension { @@ -80,4 +81,14 @@ public function getItems(Form $form): array; * return the url to the form, when clicking on `open`. append any parameters you need to your Extension */ public function getUrl(Form $form, array $extension): string; + + /* + * check if its allowed to delete the form + */ + public function canDelete(Form $form, array $extension): bool; + + /* + * check if its allowed to delete the response + */ + public function canDeleteResponse(Form $form, array $extension): bool; } diff --git a/src/Models/Form.php b/src/Models/Form.php index 95482118..4d2ec1cc 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -2,6 +2,7 @@ namespace LaraZeus\Bolt\Models; +use Filament\Notifications\Notification; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -58,7 +59,7 @@ class Form extends Model 'user_id' => 'integer', ]; - public function getTable() + public function getTable(): string { return config('zeus-bolt.table-prefix') . 'forms'; } @@ -66,33 +67,34 @@ public function getTable() protected static function booted(): void { static::deleting(function (Form $form) { + $canDelete = (bool) Extensions::init($form, 'canDelete', []); + if (! $canDelete) { + Notification::make() + ->title(__('Can\'t delete a form linked to an Extensions')) + ->danger() + ->send(); + + return false; + } + if ($form->isForceDeleting()) { - $form->fieldsResponses()->withTrashed()->get()->each(function ($item) { - $item->forceDelete(); - }); - $form->responses()->withTrashed()->get()->each(function ($item) { - $item->forceDelete(); - }); + // todo cant delete Responses if linked with item + $form->fieldsResponses()->withTrashed()->get()->each(fn ($item) => $item->forceDelete()); + $form->responses()->withTrashed()->get()->each(fn ($item) => $item->forceDelete()); $form->sections()->withTrashed()->get()->each(function ($item) { - $item->fields()->withTrashed()->get()->each(function ($item) { - $item->forceDelete(); - }); + $item->fields()->withTrashed()->get()->each(fn ($item) => $item->forceDelete()); $item->forceDelete(); }); } else { - $form->fieldsResponses->each(function ($item) { - $item->delete(); - }); - $form->responses->each(function ($item) { - $item->delete(); - }); + $form->fieldsResponses->each(fn ($item) => $item->delete()); + $form->responses->each(fn ($item) => $item->delete()); $form->sections->each(function ($item) { - $item->fields->each(function ($item) { - $item->delete(); - }); + $item->fields->each(fn ($item) => $item->delete()); $item->delete(); }); } + + return true; }); } diff --git a/src/Models/Response.php b/src/Models/Response.php index 6273d506..5d3b79ef 100644 --- a/src/Models/Response.php +++ b/src/Models/Response.php @@ -2,6 +2,7 @@ namespace LaraZeus\Bolt\Models; +use Filament\Notifications\Notification; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; use LaraZeus\Bolt\Concerns\HasUpdates; use LaraZeus\Bolt\Database\Factories\ResponseFactory; +use LaraZeus\Bolt\Facades\Extensions; /** * @property string $updated_at @@ -39,6 +41,16 @@ public function getTable() protected static function booted(): void { static::deleting(function (Response $response) { + $canDelete = (bool) Extensions::init($response->form, 'canDeleteResponse', ['response' => $response]); + if (! $canDelete) { + Notification::make() + ->title(__('Can\'t delete a form linked to an Extensions')) + ->danger() + ->send(); + + return false; + } + if ($response->isForceDeleting()) { $response->fieldsResponses()->withTrashed()->get()->each(function ($item) { $item->forceDelete(); From 55a9326f7998ef42a84f81d12c0d5b79ef922efa Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 19 Jun 2024 23:48:30 +0300 Subject: [PATCH 2/4] Update Response.php --- src/Models/Response.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Models/Response.php b/src/Models/Response.php index 5d3b79ef..1781ecaa 100644 --- a/src/Models/Response.php +++ b/src/Models/Response.php @@ -52,14 +52,12 @@ protected static function booted(): void } if ($response->isForceDeleting()) { - $response->fieldsResponses()->withTrashed()->get()->each(function ($item) { - $item->forceDelete(); - }); + $response->fieldsResponses()->withTrashed()->get()->each(fn ($item) => $item->forceDelete()); } else { - $response->fieldsResponses->each(function ($item) { - $item->delete(); - }); + $response->fieldsResponses->each(fn ($item) => $item->delete()); } + + return true; }); } From 231cb4c846db20d8546e760b31ce7159d91bff79 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 19 Jun 2024 23:49:15 +0300 Subject: [PATCH 3/4] Update Form.php --- src/Models/Form.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Models/Form.php b/src/Models/Form.php index 4d2ec1cc..3b4dab5e 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -78,7 +78,6 @@ protected static function booted(): void } if ($form->isForceDeleting()) { - // todo cant delete Responses if linked with item $form->fieldsResponses()->withTrashed()->get()->each(fn ($item) => $item->forceDelete()); $form->responses()->withTrashed()->get()->each(fn ($item) => $item->forceDelete()); $form->sections()->withTrashed()->get()->each(function ($item) { From 9b7d0eda71d110ba37cde27ba4ef25fc6b28b78b Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 19 Jun 2024 23:59:12 +0300 Subject: [PATCH 4/4] if no extension --- src/Models/Form.php | 7 ++++++- src/Models/Response.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Models/Form.php b/src/Models/Form.php index 3b4dab5e..0cec8329 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -67,7 +67,12 @@ public function getTable(): string protected static function booted(): void { static::deleting(function (Form $form) { - $canDelete = (bool) Extensions::init($form, 'canDelete', []); + $canDelete = Extensions::init($form, 'canDelete', []); + + if ($canDelete === null) { + $canDelete = true; + } + if (! $canDelete) { Notification::make() ->title(__('Can\'t delete a form linked to an Extensions')) diff --git a/src/Models/Response.php b/src/Models/Response.php index 1781ecaa..7c6e1e0f 100644 --- a/src/Models/Response.php +++ b/src/Models/Response.php @@ -41,7 +41,12 @@ public function getTable() protected static function booted(): void { static::deleting(function (Response $response) { - $canDelete = (bool) Extensions::init($response->form, 'canDeleteResponse', ['response' => $response]); + $canDelete = Extensions::init($response->form, 'canDeleteResponse', ['response' => $response]); + + if ($canDelete === null) { + $canDelete = true; + } + if (! $canDelete) { Notification::make() ->title(__('Can\'t delete a form linked to an Extensions'))