point-backend/app/Http/Resources/website/WebProjectResource.php
2024-04-03 12:10:28 +03:00

30 lines
711 B
PHP

<?php
namespace App\Http\Resources\website;
use App\Http\Resources\dashboard\ProjectImageResource;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class WebProjectResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
"id"=> $this->id,
'title' => $this->title,
'description' => $this->description,
'logo' => $this->logo ? env('APP_BASE_URL') . $this->logo : null,
'images' => ProjectImageResource::collection($this->whenLoaded('images')),
];
}
}