From 5e19be16caf33acba42b9e48bc28eab4efad58d3 Mon Sep 17 00:00:00 2001 From: titonova <41286822+titonova@users.noreply.github.com> Date: Thu, 12 Dec 2024 07:57:26 +0100 Subject: [PATCH] Added example of chaining additional completeIf for a different model --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index cc72434..bfad1d0 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,20 @@ Now you can access these steps along with their state wherever you like. Here is @endif ``` +You can also attach an additional `completeIf` metheod with a different model: + +```php + Onboard::addStep('Create Your First Post') + ->link('/post/create') + ->cta('Create Post') + ->completeIf(function (User $model) { + return $model->posts->count() > 0; + }) + ->completeIf(function (Business $model) { + return $model->posts->count() > 0 && $model->owner()->isAllowedToPost(); + }); +``` + Check out all the available features below: ```php