feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -10,10 +10,11 @@ use App\Models\Artwork;
class ContentType extends Model
{
protected $fillable = ['name','slug','description','order'];
protected $fillable = ['name','slug','description','order','hide_from_menu','mascot_path','cover_art_path'];
protected $casts = [
'order' => 'integer',
'hide_from_menu' => 'boolean',
];
public function scopeOrdered(EloquentBuilder $query): EloquentBuilder
@@ -21,6 +22,11 @@ class ContentType extends Model
return $query->orderBy('order')->orderBy('name')->orderBy('id');
}
public function scopeVisibleInToolbar(EloquentBuilder $query): EloquentBuilder
{
return $query->where('hide_from_menu', false);
}
public function categories(): HasMany
{
return $this->hasMany(Category::class);
@@ -31,6 +37,11 @@ class ContentType extends Model
return $this->categories()->whereNull('parent_id');
}
public function slugHistories(): HasMany
{
return $this->hasMany(ContentTypeSlugHistory::class);
}
/**
* Return an Eloquent builder for Artworks that belong to this content type.
* This traverses the pivot `artwork_category` via the `categories` relation.
@@ -43,8 +54,33 @@ class ContentType extends Model
});
}
public function getMascotUrlAttribute(): ?string
{
return $this->resolveAssetUrl($this->mascot_path);
}
public function getCoverArtUrlAttribute(): ?string
{
return $this->resolveAssetUrl($this->cover_art_path);
}
public function getRouteKeyName(): string
{
return 'slug';
}
private function resolveAssetUrl(?string $path): ?string
{
$path = trim((string) $path);
if ($path === '') {
return null;
}
if (str_starts_with($path, 'http://') || str_starts_with($path, 'https://') || str_starts_with($path, '/')) {
return $path;
}
return rtrim((string) config('cdn.files_url', 'https://cdn.skinbase.org'), '/') . '/' . ltrim($path, '/');
}
}