2023-12-10 04:53:31 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
class TicketResource extends JsonResource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function toArray(Request $request): array
|
2023-12-11 17:22:18 -05:00
|
|
|
{
|
2023-12-10 04:53:31 -05:00
|
|
|
$data = [
|
|
|
|
"id" => $this['id'],
|
|
|
|
"level" => $this['level'],
|
|
|
|
"reply_status" => $this['reply_status'],
|
|
|
|
"status" => $this['status'],
|
|
|
|
"subject" => $this['subject'],
|
2023-12-11 17:22:18 -05:00
|
|
|
"message" => array_key_exists('message',$this->additional) ? MessageResource::collection($this['message']) : null,
|
2023-12-10 04:53:31 -05:00
|
|
|
"created_at" => $this['created_at'],
|
|
|
|
"updated_at" => $this['updated_at']
|
|
|
|
];
|
|
|
|
if(!config('hidden_features.enable_exposed_user_count_fix')) $data['user_id']= $this['user_id'];
|
|
|
|
return $data;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|