12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
46
app/Http/Resources/PressReleaseResource.php
Normal file
46
app/Http/Resources/PressReleaseResource.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PressReleaseResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'uuid' => $this->uuid,
|
||||
'legacy' => [
|
||||
'portal' => $this->legacy_portal,
|
||||
'id' => $this->legacy_id,
|
||||
],
|
||||
'portal' => $this->portal?->value,
|
||||
'language' => $this->language,
|
||||
'title' => $this->title,
|
||||
'slug' => $this->slug,
|
||||
'text' => $this->text,
|
||||
'backlink_url' => $this->backlink_url,
|
||||
'keywords' => $this->keywords,
|
||||
'status' => $this->status?->value,
|
||||
'hits' => $this->hits,
|
||||
'teaser' => [
|
||||
'begin' => $this->teaser_begin,
|
||||
'end' => $this->teaser_end,
|
||||
],
|
||||
'no_export' => $this->no_export,
|
||||
'published_at' => $this->published_at?->toIso8601String(),
|
||||
'company' => CompanyResource::make($this->whenLoaded('company')),
|
||||
'category' => CategoryResource::make($this->whenLoaded('category')),
|
||||
'images' => PressReleaseImageResource::collection($this->whenLoaded('images')),
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
'updated_at' => $this->updated_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue