Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix published scope #2606

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Fix published scope #2606

merged 1 commit into from
Jun 13, 2024

Conversation

Tofandel
Copy link
Contributor

@Tofandel Tofandel commented Jun 11, 2024

If the model does not have the publishing feature and column, then the published scope throws an error

It's called in TwillUtil::parseInternalLinks for example, indiscriminately of the model's features

@Tofandel Tofandel force-pushed the fix/published-scope branch 2 times, most recently from ef143b7 to c6ca5cc Compare June 11, 2024 17:56
@Tofandel Tofandel force-pushed the fix/published-scope branch from c6ca5cc to 3d3c283 Compare June 11, 2024 17:58
@@ -33,12 +33,15 @@ protected function isTranslationModel(): bool
return Str::endsWith(get_class($this), 'Translation');
}

public function scopePublished($query): Builder
public function scopePublished(Builder $query): Builder
Copy link
Contributor Author

@Tofandel Tofandel Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the scopes have Builder $query in the twill interfaces, I'm actually really surprised php isn't complaining that the signature isn't compatible

interface TwillModelContract
{
public function scopePublished(Builder $query): Builder;
public function scopeAccessible(Builder $query): Builder;
public function scopeOnlyTrashed(Builder $query): Builder;
public function scopeDraft(Builder $query): Builder;
public function getTranslatedAttributes(): array;
}

@ifox ifox merged commit 786a54b into area17:3.x Jun 13, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants