forge/app/Http/Resources/ModVersionResource.php

32 lines
931 B
PHP
Raw Normal View History

2024-05-15 00:31:24 -04:00
<?php
namespace App\Http\Resources;
2024-09-12 13:19:52 -04:00
use App\Models\ModVersion;
2024-05-15 00:31:24 -04:00
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
2024-09-12 13:19:52 -04:00
/** @mixin ModVersion */
2024-05-15 00:31:24 -04:00
class ModVersionResource extends JsonResource
{
2024-09-12 13:19:52 -04:00
/**
* Transform the resource into an array.
*/
2024-05-15 00:31:24 -04:00
public function toArray(Request $request): array
{
return [
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
2024-07-26 09:34:57 -04:00
'published_at' => $this->published_at,
2024-05-15 00:31:24 -04:00
'id' => $this->id,
'version' => $this->version,
'description' => $this->description,
'virus_total_link' => $this->virus_total_link,
'downloads' => $this->downloads,
'mod_id' => $this->mod_id,
'mod' => new ModResource($this->whenLoaded('mod')),
'sptVersion' => new SptVersionResource($this->whenLoaded('sptVersion')),
];
}
}