diff --git a/src/HasTags.php b/src/HasTags.php index 41c8f87..d186e58 100644 --- a/src/HasTags.php +++ b/src/HasTags.php @@ -89,7 +89,7 @@ public function setTagsAttribute(string | array | ArrayAccess | Tag $tags) public function scopeWithAllTags( Builder $query, string | array | ArrayAccess | Tag $tags, - string $type = null, + ?string $type = null, ): Builder { $tags = static::convertToTags($tags, $type); @@ -105,7 +105,7 @@ public function scopeWithAllTags( public function scopeWithAnyTags( Builder $query, string | array | ArrayAccess | Tag $tags, - string $type = null, + ?string $type = null, ): Builder { $tags = static::convertToTags($tags, $type); @@ -120,7 +120,7 @@ public function scopeWithAnyTags( public function scopeWithoutTags( Builder $query, string | array | ArrayAccess | Tag $tags, - string $type = null + ?string $type = null ): Builder { $tags = static::convertToTags($tags, $type); @@ -159,12 +159,12 @@ public function scopeWithAnyTagsOfAnyType(Builder $query, $tags): Builder ); } - public function tagsWithType(string $type = null): Collection + public function tagsWithType(?string $type = null): Collection { return $this->tags->filter(fn (Tag $tag) => $tag->type === $type); } - public function attachTags(array | ArrayAccess | Tag $tags, string $type = null): static + public function attachTags(array | ArrayAccess | Tag $tags, ?string $type = null): static { $className = static::getTagClassName(); @@ -300,7 +300,7 @@ protected function syncTagIds($ids, string | null $type = null, $detaching = tru } } - public function hasTag($tag, string $type = null): bool + public function hasTag($tag, ?string $type = null): bool { return $this->tags ->when($type !== null, fn ($query) => $query->where('type', $type))