adrema/app/Nami/Api/FullMemberAction.php

29 lines
721 B
PHP
Raw Normal View History

2023-02-23 00:38:17 +01:00
<?php
namespace App\Nami\Api;
use App\Member\Data\FullMember;
use Illuminate\Support\Facades\Redis;
use Lorisleiva\Actions\Concerns\AsAction;
use Zoomyboy\LaravelNami\Api;
class FullMemberAction
{
use AsAction;
public function handle(Api $api, int $groupId, int $memberId, ?string $redisKey = null): FullMember
{
$fullMember = FullMember::from([
'member' => MemberAction::run($api, $groupId, $memberId),
'memberships' => MembershipsOfAction::run($api, $memberId),
'courses' => CoursesOfAction::run($api, $memberId),
]);
2023-05-03 21:26:27 +02:00
if ($redisKey) {
Redis::rpush($redisKey, $fullMember->toJson());
2023-02-23 00:38:17 +01:00
}
return $fullMember;
}
}