123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace Themes\Pro\modunawa\app\Http\Controllers\Auth;
- use App\Http\Controllers\Controller;
- use App\Services\CallApiService;
- class MemberWithdrawalController extends Controller
- {
- private $callApiService;
- public function __construct(CallApiService $callApiService)
- {
- $this->callApiService = $callApiService;
- }
- public function index()
- {
- return view('views.auth.member-withdrawal');
- }
- public function store()
- {
- $response = $this->callApiService->callApi([
- 'url' => 'member-login',
- 'data' => [
- 'Email' => session('member')['Email'],
- 'Password' => request('password')
- ]
- ]);
- if ($this->callApiService->verifyApiError($response)) {
- notify()->error('현재 비밀번호를 입력해주세요', 'Error', 'bottomRight');
- return redirect()->back();
- }
- $memberId = session('member')['MemberId'];
- $memberSecuredAct = $this->callApiService->callApi([
- 'url' => 'member-act',
- 'data' => [
- 'Page' => [
- [
- 'Id' => $memberId,
- 'IsWithdrawn' => '1',
- ]
- ]
- ],
- ]);
- if ($this->callApiService->verifyApiError($memberSecuredAct)) {
- notify()->error($memberSecuredAct['body'], 'Error', 'bottomRight');
- return redirect()->back();
- }
- notify()->success(_e('Action completed'), 'Success', 'bottomRight');
- return redirect()->route('member-logout');
- }
- }
|