From c38190d29fe85991c85eb3adb37b7f6653f82f05 Mon Sep 17 00:00:00 2001 From: alexkrivonos Date: Mon, 14 Sep 2026 19:29:00 +0200 Subject: [PATCH] docs: document CallbackCheck usage and update dependencies --- README.md | 17 ++++++++++++++-- composer.lock | 56 +++++++++++++++++++++++++-------------------------- 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 8d2d904..22d2557 100644 --- a/README.md +++ b/README.md @@ -214,8 +214,21 @@ ActionGuardAction::make('publish') | `NotEmptyCheck` | Value is not empty string/whitespace/empty array/empty collection (safely preserves `0`, `'0'`, `0.00`) | `NotEmptyCheck::make('price')` | | `ConditionCheck` | Boolean callback closure | `ConditionCheck::make('min_stock', fn ($record) => $record->stock > 0, 'Stock must be greater than zero')` | | `RelationshipCheck` | Eloquent relationship resolves to a model or non-empty collection; it may lazy-load the relation | `RelationshipCheck::make('category')` | -| `MediaCheck` | Spatie MediaLibrary or array of image URLs | `MediaCheck::make('image_url')` | -| `CallbackCheck` | Evaluates custom logic returning `CheckResult` | `CallbackCheck::make('vat_id', fn ($record) => ...)` | +| `MediaCheck` | Non-empty Spatie MediaLibrary collection, string attribute, or array attribute | `MediaCheck::make('image_url')` | +| `CallbackCheck` | Evaluates custom logic that returns a `CheckResult` | `CallbackCheck::make('vat_id')->check(...)` | + +`CallbackCheck` callbacks must return a `CheckResult` explicitly: + +```php +use Allgorithm\FilamentActionGuard\Checks\CallbackCheck; +use Allgorithm\FilamentActionGuard\Results\CheckResult; + +CallbackCheck::make('vat_id')->check(function ($record): CheckResult { + return filled($record->vat_id) + ? CheckResult::pass('vat_id', 'VAT ID') + : CheckResult::fail('vat_id', 'VAT ID', 'A VAT ID is required.'); +}); +``` --- diff --git a/composer.lock b/composer.lock index 73e838c..2414504 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "anourvalar/eloquent-serialize", - "version": "1.3.11", + "version": "1.3.12", "source": { "type": "git", "url": "https://github.com/AnourValar/eloquent-serialize.git", - "reference": "abd890c4d1ad8e90dd454d01283fbf342f80f1e5" + "reference": "eb46e698efe7e20c311f1f93830111fcdcdabd96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AnourValar/eloquent-serialize/zipball/abd890c4d1ad8e90dd454d01283fbf342f80f1e5", - "reference": "abd890c4d1ad8e90dd454d01283fbf342f80f1e5", + "url": "https://api.github.com/repos/AnourValar/eloquent-serialize/zipball/eb46e698efe7e20c311f1f93830111fcdcdabd96", + "reference": "eb46e698efe7e20c311f1f93830111fcdcdabd96", "shasum": "" }, "require": { @@ -67,9 +67,9 @@ ], "support": { "issues": "https://github.com/AnourValar/eloquent-serialize/issues", - "source": "https://github.com/AnourValar/eloquent-serialize/tree/1.3.11" + "source": "https://github.com/AnourValar/eloquent-serialize/tree/1.3.12" }, - "time": "2026-08-07T06:14:19+00:00" + "time": "2026-09-13T06:25:37+00:00" }, { "name": "blade-ui-kit/blade-heroicons", @@ -3424,16 +3424,16 @@ }, { "name": "nesbot/carbon", - "version": "3.13.2", + "version": "3.14.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon.git", - "reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb" + "reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/a1c54919f5fff9800cd03c32bd01defd5a4061cb", - "reference": "a1c54919f5fff9800cd03c32bd01defd5a4061cb", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/0023eaa2c9110e47446dd512a263c69c40cd41f2", + "reference": "0023eaa2c9110e47446dd512a263c69c40cd41f2", "shasum": "" }, "require": { @@ -3525,7 +3525,7 @@ "type": "tidelift" } ], - "time": "2026-08-08T11:40:35+00:00" + "time": "2026-09-12T20:45:19+00:00" }, { "name": "nette/php-generator", @@ -8862,16 +8862,16 @@ }, { "name": "larastan/larastan", - "version": "v3.12.0", + "version": "v3.12.1", "source": { "type": "git", "url": "https://github.com/larastan/larastan.git", - "reference": "ab26fdf90d84877061388109e1e251f67ca3ff7a" + "reference": "168fd3b955e723c51dbf81709849b0c3ac4ac5f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/ab26fdf90d84877061388109e1e251f67ca3ff7a", - "reference": "ab26fdf90d84877061388109e1e251f67ca3ff7a", + "url": "https://api.github.com/repos/larastan/larastan/zipball/168fd3b955e723c51dbf81709849b0c3ac4ac5f6", + "reference": "168fd3b955e723c51dbf81709849b0c3ac4ac5f6", "shasum": "" }, "require": { @@ -8884,7 +8884,7 @@ "illuminate/pipeline": "^11.44.2 || ^12.4.1 || ^13", "illuminate/support": "^11.44.2 || ^12.4.1 || ^13", "php": "^8.2", - "phpstan/phpstan": "^2.2.2" + "phpstan/phpstan": "^2.2.14" }, "require-dev": { "doctrine/coding-standard": "^14", @@ -8939,7 +8939,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v3.12.0" + "source": "https://github.com/larastan/larastan/tree/v3.12.1" }, "funding": [ { @@ -8947,7 +8947,7 @@ "type": "github" } ], - "time": "2026-09-10T09:06:54+00:00" + "time": "2026-09-13T15:17:35+00:00" }, { "name": "laravel/pail", @@ -9312,16 +9312,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.8.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f" + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f", - "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def", + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def", "shasum": "" }, "require": { @@ -9363,9 +9363,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" }, - "time": "2026-07-04T14:30:18+00:00" + "time": "2026-09-13T18:51:52+00:00" }, { "name": "nunomaduro/collision", @@ -10681,11 +10681,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.13", + "version": "2.2.14", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9ba9ac76ee9c5cf5b56d58eb5deec6315b7a0260", - "reference": "9ba9ac76ee9c5cf5b56d58eb5deec6315b7a0260", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac", + "reference": "9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac", "shasum": "" }, "require": { @@ -10741,7 +10741,7 @@ "type": "github" } ], - "time": "2026-09-03T20:38:19+00:00" + "time": "2026-09-12T21:39:33+00:00" }, { "name": "phpunit/php-code-coverage",