Files
fotospiel-app/app/Http/Resources/Tenant/TaskCollectionResource.php
Codex Agent 1a4bdb1fe1 tenant admin startseite schicker gestaltet und super-admin und tenant admin (filament) aufgesplittet.
Es gibt nun task collections und vordefinierte tasks für alle. Onboarding verfeinert und webseite-carousel gefixt (logging später entfernen!)
2025-10-14 15:17:52 +02:00

43 lines
1.4 KiB
PHP

<?php
namespace App\Http\Resources\Tenant;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class TaskCollectionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'slug' => $this->slug,
'name' => $this->name,
'name_translations' => $this->name_translations,
'description' => $this->description,
'description_translations' => $this->description_translations,
'tenant_id' => $this->tenant_id,
'is_global' => $this->tenant_id === null,
'event_type' => $this->whenLoaded('eventType', function () {
return [
'id' => $this->eventType->id,
'slug' => $this->eventType->slug,
'name' => $this->eventType->name,
'icon' => $this->eventType->icon,
];
}),
'tasks_count' => $this->whenCounted('tasks'),
'is_default' => (bool) ($this->is_default ?? false),
'position' => $this->position,
'source_collection_id' => $this->source_collection_id,
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),
];
}
}