32 lines
663 B
PHP
32 lines
663 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class GameWebsite extends Model
|
|
{
|
|
protected $fillable = ['game_id', 'category', 'url'];
|
|
|
|
public const CATEGORY_LABELS = [
|
|
1 => 'Official',
|
|
2 => 'Wikia',
|
|
3 => 'Wikipedia',
|
|
9 => 'YouTube',
|
|
13 => 'Steam',
|
|
16 => 'Epic Games',
|
|
17 => 'GOG',
|
|
];
|
|
|
|
public function game(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Game::class);
|
|
}
|
|
|
|
public function getLabelAttribute(): string
|
|
{
|
|
return self::CATEGORY_LABELS[$this->category] ?? 'Website';
|
|
}
|
|
}
|