adrema/app/Membership/MembershipController.php

26 lines
638 B
PHP
Raw Permalink Normal View History

2021-08-22 22:23:17 +02:00
<?php
namespace App\Membership;
use App\Http\Controllers\Controller;
use App\Member\Member;
2021-08-22 23:32:54 +02:00
use App\Member\Membership;
2022-03-06 02:57:39 +01:00
use App\Setting\NamiSettings;
2021-08-22 22:23:17 +02:00
use Illuminate\Http\RedirectResponse;
class MembershipController extends Controller
{
2022-05-01 20:30:14 +02:00
public function destroy(Member $member, Membership $membership, NamiSettings $settings): RedirectResponse
2021-08-22 23:32:54 +02:00
{
2022-05-01 20:30:14 +02:00
$api = $settings->login();
$api->deleteMembership(
$member->nami_id,
$api->membership($member->nami_id, $membership->nami_id)
);
2021-08-22 23:32:54 +02:00
$membership->delete();
2022-05-01 20:30:14 +02:00
$member->syncVersion();
2021-08-22 23:32:54 +02:00
return redirect()->back();
}
2021-08-22 22:23:17 +02:00
}