12-05-2026 Frontend dev
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run

This commit is contained in:
Kevin Adametz 2026-05-12 18:32:33 +02:00
parent 405df0a122
commit 5b8bdf4182
779 changed files with 480564 additions and 6241 deletions

View file

@ -0,0 +1,46 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PressReleaseImageResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
$variants = is_array($this->variants) ? $this->variants : [];
$variantUrls = [];
foreach ($variants as $key => $relativePath) {
if (is_string($relativePath) && filled($relativePath)) {
$variantUrls[$key] = asset('storage/'.ltrim($relativePath, '/'));
}
}
return [
'id' => $this->id,
'press_release_id' => $this->press_release_id,
'url' => $this->url(),
'urls' => array_merge(['original' => $this->url()], $variantUrls),
'variants' => $variants,
'disk' => $this->disk,
'path' => $this->path,
'title' => $this->title,
'description' => $this->description,
'copyright' => $this->copyright,
'is_preview' => $this->is_preview,
'sort_order' => $this->sort_order,
'width' => $this->width,
'height' => $this->height,
'mime' => $this->mime,
'created_at' => $this->created_at?->toIso8601String(),
'updated_at' => $this->updated_at?->toIso8601String(),
];
}
}