From 70006a5cfc547a9e42019c22072340e83d63e665 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Wed, 10 Aug 2022 12:49:51 +0200 Subject: [PATCH] Add arrayable support --- src/OnboardingStep.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/OnboardingStep.php b/src/OnboardingStep.php index 4bc3e84..4d11b1b 100644 --- a/src/OnboardingStep.php +++ b/src/OnboardingStep.php @@ -2,10 +2,11 @@ namespace Spatie\Onboard; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Arr; use Spatie\Onboard\Concerns\Onboardable; -class OnboardingStep +class OnboardingStep implements Arrayable { protected array $attributes = []; @@ -111,4 +112,12 @@ public function __isset(string $key): bool { return isset($this->attributes[$key]); } + + public function toArray() + { + return array_merge($this->attributes, [ + 'complete' => $this->complete(), + 'excluded' => $this->excluded(), + ]); + } }