Initial commit: Import existing Laravel project
This commit is contained in:
30
app/Http/Resources/OrderStatusLogResource.php
Normal file
30
app/Http/Resources/OrderStatusLogResource.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user