public function closeAccount(Request $request)
    {
        $this->validate(
            $request,
            [
                'confirm' => 'required|regex:/close my account/',
            ]
        );

        Auth::user()->watching()->detach();

        if (mustard_loaded('commerce')) {
            Auth::user()->bankDetails()->delete();
        }

        if (mustard_loaded('feedback')) {
            Auth::user()->feedbackReceived()->update(['subject_user_id' => null]);
        }

        if (mustard_loaded('messaging')) {
            Auth::user()->messages()->delete();
        }

        return redirect()->back()->withStatus(trans('mustard::account.close_confirmed'));
    }
public function closeAccount(Request $request)
    {
        $this->validate(
            $request,
            [
                'confirm' => 'required|regex:/close my account/',
            ]
        );

        Auth::user()->watching()->detach();

        if (mustard_loaded('commerce')) {
            Auth::user()->bankDetails()->delete();
        }

        if (mustard_loaded('feedback')) {
            Auth::user()->feedbackReceived()->update(['subject_user_id' => null]);
        }

        if (mustard_loaded('messaging')) {
            Auth::user()->messages()->delete();
        }

        return redirect()->back()->withStatus(trans('mustard::account.close_confirmed'));
    }
public function closeAccount ( Request $ request ) { $ this -> validate ( $ request , [ 'confirm' => 'required|regex:/close my account/' , ] ) ; Auth :: user ( ) -> watching ( ) -> detach ( ) ; if ( mustard_loaded ( 'commerce' ) ) { Auth :: user ( ) -> bankDetails ( ) -> delete ( ) ; } if ( mustard_loaded ( 'feedback' ) ) { Auth :: user ( ) -> feedbackReceived ( ) -> update ( [ 'subject_user_id' => null ] ) ; } if ( mustard_loaded ( 'messaging' ) ) { Auth :: user ( ) -> messages ( ) -> delete ( ) ; } return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::account.close_confirmed' ) ) ; }
Close an account.

@return \Illuminate\Http\RedirectResponse
Close an account .