From 7c45d0de30ca95e62c0d7eebdaea4f5f48660e10 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Tue, 13 Jun 2023 20:54:05 +0200 Subject: [PATCH] fix: fix AddPostToSliceOfLife (#6681) --- .../Vault/ManageJournals/Services/AddPostToSliceOfLife.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Domains/Vault/ManageJournals/Services/AddPostToSliceOfLife.php b/app/Domains/Vault/ManageJournals/Services/AddPostToSliceOfLife.php index 99ca223e1d3..5268e0766e7 100644 --- a/app/Domains/Vault/ManageJournals/Services/AddPostToSliceOfLife.php +++ b/app/Domains/Vault/ManageJournals/Services/AddPostToSliceOfLife.php @@ -11,7 +11,7 @@ class AddPostToSliceOfLife extends BaseService implements ServiceInterface { private Post $post; - private SliceOfLife $slice; + private ?SliceOfLife $slice; private array $data; @@ -50,8 +50,7 @@ public function execute(array $data): SliceOfLife $this->data = $data; $this->validate(); - /** @phpstan-ignore-next-line */ - $this->post->slice_of_life_id = $this->slice ? $this->slice->id : null; + $this->post->slice_of_life_id = optional($this->slice)->id; $this->post->save(); return $this->slice;