mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
27 lines
658 B
PHP
27 lines
658 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RemarkResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'commenter' => new UserResource($this->commenter),
|
|
'owner_id' => $this->owner_id,
|
|
'content' => $this->content,
|
|
'created_at' => $this->created_at->format('d-m-Y H:i'),
|
|
'long_ago' => $this->created_at->diffForHumans()
|
|
];
|
|
}
|
|
}
|