adrema/app/Http/Views/MemberTriesResource.php

27 lines
656 B
PHP
Raw Normal View History

2021-08-23 01:59:53 +02:00
<?php
namespace App\Http\Views;
use App\Member\MemberResource;
use Illuminate\Http\Resources\Json\JsonResource;
2022-01-02 12:32:57 +01:00
/**
* @mixin \App\Member\Member
*/
2021-08-23 01:59:53 +02:00
class MemberTriesResource extends MemberResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return array_merge(parent::toArray($request), [
'try_ends_at' => $this->getModel()->try_created_at->addWeeks(8)->format('d.m.Y'),
'try_ends_at_human' => $this->getModel()->try_created_at->addWeeks(8)->diffForHumans(),
]);
}
}