31 lines
778 B
PHP
31 lines
778 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class OrderStatusLogResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'order_id' => $this->order_id,
|
|
'user' => [
|
|
'id' => $this->user?->id,
|
|
'name' => $this->user?->name,
|
|
'role' => $this->user?->role,
|
|
],
|
|
'old_status' => $this->old_status,
|
|
'new_status' => $this->new_status,
|
|
'changed_at' => $this->changed_at?->format('d/m/Y H:i'),
|
|
];
|
|
}
|
|
}
|