diff --git a/app/Member/DeleteJob.php b/app/Member/DeleteJob.php index f55803a9..2325c852 100644 --- a/app/Member/DeleteJob.php +++ b/app/Member/DeleteJob.php @@ -16,12 +16,11 @@ class DeleteJob implements ShouldQueue use Queueable; use SerializesModels; - public int $memberId; - public Member $member; + public int $namiId; - public function __construct(Member $member) + public function __construct(int $namiId) { - $this->memberId = $member->id; + $this->namiId = $namiId; } /** @@ -31,16 +30,6 @@ class DeleteJob implements ShouldQueue */ public function handle(NamiSettings $setting) { - $this->member = Member::find($this->memberId); - - if (!$this->member->hasNami) { - return; - } - - $setting->login()->deleteMember($this->member->nami_id); - - Member::withoutEvents(function () { - $this->member->update(['nami_id' => null]); - }); + $setting->login()->deleteMember($this->namiId); } } diff --git a/app/Member/MemberController.php b/app/Member/MemberController.php index 676f8aef..8767bf14 100644 --- a/app/Member/MemberController.php +++ b/app/Member/MemberController.php @@ -127,8 +127,8 @@ class MemberController extends Controller public function destroy(Member $member): RedirectResponse { - if ($member->has_nami) { - DeleteJob::dispatch($member, auth()->user()); + if ($member->nami_id) { + DeleteJob::dispatch($member->nami_id); } $member->delete(); diff --git a/app/Member/MemberRequest.php b/app/Member/MemberRequest.php index bf75f66b..ee1a834b 100644 --- a/app/Member/MemberRequest.php +++ b/app/Member/MemberRequest.php @@ -103,7 +103,7 @@ class MemberRequest extends FormRequest UpdateJob::dispatch($member->fresh()); } if (!$this->input('has_nami') && null !== $member->nami_id) { - DeleteJob::dispatch($member); + DeleteJob::dispatch($member->nami_id); } } }