Refactor Inertia responses to use resources
linter / quality (pull_request) Successful in 1m15s
tests / ci (8.4) (pull_request) Successful in 1m29s

This commit is contained in:
Eric Peters
2026-04-15 18:09:08 +02:00
parent 5a7972df7c
commit 017cff5437
38 changed files with 1125 additions and 382 deletions
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources;
use App\Models\Ticket;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Arr;
class TicketReferenceResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->resource instanceof Ticket ? $this->id : Arr::get($this->resource, 'id'),
'ticket_key' => $this->resource instanceof Ticket ? $this->ticket_key : Arr::get($this->resource, 'ticket_key'),
'title' => $this->resource instanceof Ticket ? $this->title : Arr::get($this->resource, 'title'),
];
}
}