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

@@ -9,11 +9,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ArtworkAward extends Model
{
protected $table = 'artwork_awards';
protected $table = 'artwork_medals';
protected $fillable = [
'artwork_id',
'user_id',
'medal_type',
'medal',
'weight',
];
@@ -27,11 +28,26 @@ class ArtworkAward extends Model
public const MEDALS = ['gold', 'silver', 'bronze'];
public const WEIGHTS = [
'gold' => 3,
'silver' => 2,
'gold' => 5,
'silver' => 3,
'bronze' => 1,
];
public static function weightFor(string $medal): int
{
return (int) config('artwork_medals.weights.' . $medal, self::WEIGHTS[$medal] ?? 0);
}
/**
* @return array<string, int>
*/
public static function weights(): array
{
return collect(self::MEDALS)
->mapWithKeys(fn (string $medal): array => [$medal => self::weightFor($medal)])
->all();
}
public function artwork(): BelongsTo
{
return $this->belongsTo(Artwork::class);
@@ -41,4 +57,14 @@ class ArtworkAward extends Model
{
return $this->belongsTo(User::class);
}
public function getMedalAttribute(): ?string
{
return $this->attributes['medal_type'] ?? null;
}
public function setMedalAttribute(?string $value): void
{
$this->attributes['medal_type'] = $value;
}
}