adrema/app/Membership/MembershipResource.php

33 lines
815 B
PHP
Raw Permalink Normal View History

2021-08-22 22:23:17 +02:00
<?php
namespace App\Membership;
use Illuminate\Http\Resources\Json\JsonResource;
2022-01-02 12:32:57 +01:00
/**
* @mixin \App\Member\Membership
*/
2021-08-22 22:23:17 +02:00
class MembershipResource extends JsonResource
{
/**
* Transform the resource into an array.
*
2022-03-11 20:19:17 +01:00
* @param \Illuminate\Http\Request $request
*
2021-08-22 22:23:17 +02:00
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'group_id' => $this->group_id,
2021-08-22 22:23:17 +02:00
'activity_id' => $this->activity_id,
'activity_name' => $this->activity->name,
'subactivity_id' => $this->subactivity_id,
2022-11-16 22:28:42 +01:00
'subactivity_name' => $this->subactivity?->name,
2023-02-27 22:00:27 +01:00
'human_date' => $this->from->format('d.m.Y'),
2022-12-14 15:49:12 +01:00
'promised_at' => $this->promised_at?->format('Y-m-d'),
2021-08-22 22:23:17 +02:00
];
}
}