forge/app/Http/Resources/ModResource.php

31 lines
829 B
PHP
Raw Permalink 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\Mod;
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 Mod */
2024-05-15 00:31:24 -04:00
class ModResource 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 [
'id' => $this->id,
'name' => $this->name,
'slug' => $this->slug,
'description' => $this->description,
'source_code_link' => $this->source_code_link,
'license_id' => $this->license_id,
'license' => new LicenseResource($this->whenLoaded('license')),
'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
];
}
}