Skip to content

Commit

Permalink
Fix published scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel committed Jun 11, 2024
1 parent 9fa1acf commit 282fd5e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ protected function isTranslationModel(): bool

public function scopePublished($query): Builder
{
return $query->where("{$this->getTable()}.published", true);
if ($this->isFillable('published')) {
return $query->where($query->qualifyColumn("published"), true);
}
return $query;
}

public function scopeAccessible($query): Builder
Expand Down Expand Up @@ -120,7 +123,10 @@ public function setPublishStartDateAttribute($value): void

public function scopeDraft($query): Builder
{
return $query->where("{$this->getTable()}.published", false);
if ($this->isFillable('published')) {
return $query->where($query->qualifyColumn('published'), false);
}
return $query;
}

public function scopeOnlyTrashed($query): Builder
Expand Down

0 comments on commit 282fd5e

Please sign in to comment.