diff --git a/app/Membership/MembershipController.php b/app/Membership/MembershipController.php index 0dd057e7..ba1730ec 100644 --- a/app/Membership/MembershipController.php +++ b/app/Membership/MembershipController.php @@ -2,8 +2,10 @@ namespace App\Membership; +use App\Activity; use App\Http\Controllers\Controller; use App\Member\Member; +use App\Subactivity; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -11,7 +13,18 @@ class MembershipController extends Controller { public function store(Member $member, Request $request): RedirectResponse { - $member->memberships()->create($request->input()); + $namiId = auth()->user()->api()->group($member->group->nami_id)->member($member->nami_id) + ->putMembership([ + 'created_at' => now(), + 'group_id' => $member->group->nami_id, + 'activity_id' => Activity::find($request->input('activity_id'))->nami_id, + 'subactivity_id' => optional(Subactivity::find($request->input('subactivity_id')))->nami_id, + ]); + + $membership = $member->memberships()->create(array_merge( + $request->input(), + ['nami_id' => $namiId], + )); return redirect()->back(); } diff --git a/packages/laravel-nami b/packages/laravel-nami index 04d5e6f0..9f5324b0 160000 --- a/packages/laravel-nami +++ b/packages/laravel-nami @@ -1 +1 @@ -Subproject commit 04d5e6f03ad8d8a6308ecdc84a84b3557fec5e76 +Subproject commit 9f5324b0d00a417c90d5ca1473d16ff350ad4f1d