Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/HasTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

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

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