2022-12-01 12:13:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
2023-09-08 11:00:28 +00:00
|
|
|
class FormTemplateResource extends JsonResource
|
2022-12-01 12:13:32 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
2023-09-08 11:00:28 +00:00
|
|
|
return array_merge(parent::toArray($request), [
|
2024-02-23 10:54:12 +00:00
|
|
|
'is_new' => $this->created_at->isAfter(now()->subDays(7)),
|
2023-09-08 11:00:28 +00:00
|
|
|
]);
|
2022-12-01 12:13:32 +00:00
|
|
|
}
|
|
|
|
}
|