Skip to content

Commit

Permalink
fix: fix AddPostToSliceOfLife (#6681)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Jun 13, 2023
1 parent 05c1333 commit 7c45d0d
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AddPostToSliceOfLife extends BaseService implements ServiceInterface
{
private Post $post;

private SliceOfLife $slice;
private ?SliceOfLife $slice;

private array $data;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7c45d0d

Please sign in to comment.