Save workspace changes
This commit is contained in:
@@ -249,6 +249,11 @@ class Artwork extends Model
|
||||
return $this->hasMany(ArtworkContributor::class)->orderBy('sort_order');
|
||||
}
|
||||
|
||||
public function worldSubmissions(): HasMany
|
||||
{
|
||||
return $this->hasMany(WorldSubmission::class)->orderByDesc('reviewed_at')->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function isPublishedByGroup(): bool
|
||||
{
|
||||
return $this->publishedAsType() === self::PUBLISHED_AS_GROUP;
|
||||
@@ -516,6 +521,20 @@ class Artwork extends Model
|
||||
->where("{$table}.published_at", '<=', now());
|
||||
}
|
||||
|
||||
public function scopeCatalogVisible(Builder $query): Builder
|
||||
{
|
||||
$table = $this->getTable();
|
||||
|
||||
return $query
|
||||
->approved()
|
||||
->where("{$table}.is_public", true)
|
||||
->where(function (Builder $visibilityQuery) use ($table): void {
|
||||
$visibilityQuery->whereNull("{$table}.visibility")
|
||||
->orWhere("{$table}.visibility", self::VISIBILITY_PUBLIC);
|
||||
})
|
||||
->published();
|
||||
}
|
||||
|
||||
public function scopeSafeForGeneralAudience(Builder $query): Builder
|
||||
{
|
||||
$table = $this->getTable();
|
||||
|
||||
Reference in New Issue
Block a user