build: initialize RetroHub with Laravel, Inertia, Vue, and Horizon
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Features\Consoles\Data;
|
||||
|
||||
use App\Features\Consoles\Models\Console;
|
||||
use Spatie\LaravelData\Attributes\MapInputName;
|
||||
use Spatie\LaravelData\Data;
|
||||
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
|
||||
|
||||
#[MapInputName(SnakeCaseMapper::class)]
|
||||
class ConsoleData extends Data
|
||||
{
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public string $name,
|
||||
public string $slug,
|
||||
public ?string $iconPath,
|
||||
public array $romExtensions,
|
||||
public ?int $igdbPlatformId,
|
||||
public ?int $tgdbPlatformId,
|
||||
public int $gamesCount,
|
||||
) {}
|
||||
|
||||
public static function fromModel(Console $console): self
|
||||
{
|
||||
return new self(
|
||||
id: $console->id,
|
||||
name: $console->name,
|
||||
slug: $console->slug,
|
||||
iconPath: $console->icon_path,
|
||||
romExtensions: $console->rom_extensions,
|
||||
igdbPlatformId: $console->igdb_platform_id,
|
||||
tgdbPlatformId: $console->tgdb_platform_id,
|
||||
gamesCount: $console->games_count ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user