adrema/app/Member/Actions/MemberShowAction.php

28 lines
673 B
PHP
Raw Normal View History

2022-11-18 15:55:44 +01:00
<?php
namespace App\Member\Actions;
use App\Member\Member;
use App\Member\MemberResource;
2024-08-28 22:12:05 +02:00
use Illuminate\Http\JsonResponse;
2022-11-18 15:55:44 +01:00
use Lorisleiva\Actions\Concerns\AsAction;
class MemberShowAction
{
use AsAction;
2024-08-28 22:12:05 +02:00
public function asController(Member $member): JsonResponse
2022-11-18 15:55:44 +01:00
{
2024-08-28 22:12:05 +02:00
return response()->json([
'data' => new MemberResource($member
->load('memberships')
->load('invoicePositions.invoice')
->load('nationality')
->load('region')
->load('subscription')
->load('courses.course')),
2023-05-02 23:13:00 +02:00
'meta' => MemberResource::meta(),
2024-08-28 22:12:05 +02:00
]);
2022-11-18 15:55:44 +01:00
}
}