You've already forked Atomcms-edit
75b78c17fa
- Fix timing attack vulnerability in AuthController - Split web.php (316 lines) into 7 focused route files - Add 8 API Resources for consistent response formatting - Add 8 FormRequest classes for centralized validation - Use Resources instead of manual array mapping in controllers
28 lines
807 B
PHP
Executable File
28 lines
807 B
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\Api;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class HelpTicketResource extends JsonResource
|
|
{
|
|
#[\Override]
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'user_id' => $this->user_id,
|
|
'subject' => $this->subject,
|
|
'category' => $this->category,
|
|
'status' => $this->status,
|
|
'user' => $this->whenLoaded('user', fn () => new UserBriefResource($this->user)),
|
|
'replies' => $this->whenLoaded('replies', fn () => HelpTicketReplyResource::collection($this->replies)),
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|