Fixed: Delete membership

This commit is contained in:
Philipp Lang 2022-05-01 20:30:14 +02:00
parent cd1f2a7e11
commit ae7d23c4dd
1 changed files with 7 additions and 5 deletions

View File

@ -18,13 +18,15 @@ class MembershipController extends Controller
return redirect()->back();
}
public function destroy(Member $member, Membership $membership): RedirectResponse
public function destroy(Member $member, Membership $membership, NamiSettings $settings): RedirectResponse
{
auth()->user()->api()->group($member->group->nami_id)->member($member->nami_id)
->deleteMembership($membership->nami_id);
$api = $settings->login();
$api->deleteMembership(
$member->nami_id,
$api->membership($member->nami_id, $membership->nami_id)
);
$membership->delete();
$member->syncVersion(auth()->user()->api());
$member->syncVersion();
return redirect()->back();
}