New-Thanasoft/thanasoft-back/app/Http/Resources/DocumentStatusHistoryResource.php

27 lines
683 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class DocumentStatusHistoryResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'old_status' => $this->old_status,
'new_status' => $this->new_status,
'changed_at' => $this->changed_at,
'changed_by' => $this->user ? $this->user->name : 'System', // Simple user display
'comment' => $this->comment,
];
}
}