src/lib/Http/Controllers/AccountController.php
public function postBankDetails(Request $request)
    {
        $this->validates(
            $request->all(),
            [
                'account_number' => 'required|accountnumber',
                'sort_code' => 'required|sortcode',
            ]
        );

        $bank_details = Auth::user()->bankDetails ? Auth::user()->bankDetails : new BankDetail;

        $bank_details->accountNumber = $request->input('account_number');
        $bank_details->sortCode = $request->input('sort_code');

        if (!$bank_details->exists) {
            $bank_details->user()->associate(Auth::user());
        }

        $bank_details->save();

        Auth::user()->sendEmail(
            'Your bank details have been changed',
            'emails.account.bank-details-changed'
        );

        return redirect('/account/bank-details')
            ->withStatus('Your bank details have been changed.');
    }
public function postBankDetails(Request $request)
    {
        $this->validates(
            $request->all(),
            [
                'account_number' => 'required|accountnumber',
                'sort_code' => 'required|sortcode',
            ]
        );

        $bank_details = Auth::user()->bankDetails ? Auth::user()->bankDetails : new BankDetail;

        $bank_details->accountNumber = $request->input('account_number');
        $bank_details->sortCode = $request->input('sort_code');

        if (!$bank_details->exists) {
            $bank_details->user()->associate(Auth::user());
        }

        $bank_details->save();

        Auth::user()->sendEmail(
            'Your bank details have been changed',
            'emails.account.bank-details-changed'
        );

        return redirect('/account/bank-details')
            ->withStatus('Your bank details have been changed.');
    }
public function postBankDetails ( Request $ request ) { $ this -> validates ( $ request -> all ( ) , [ 'account_number' => 'required|accountnumber' , 'sort_code' => 'required|sortcode' , ] ) ; $ bank_details = Auth :: user ( ) -> bankDetails ? Auth :: user ( ) -> bankDetails : new BankDetail ; $ bank_details -> accountNumber = $ request -> input ( 'account_number' ) ; $ bank_details -> sortCode = $ request -> input ( 'sort_code' ) ; if ( ! $ bank_details -> exists ) { $ bank_details -> user ( ) -> associate ( Auth :: user ( ) ) ; } $ bank_details -> save ( ) ; Auth :: user ( ) -> sendEmail ( 'Your bank details have been changed' , 'emails.account.bank-details-changed' ) ; return redirect ( '/account/bank-details' ) -> withStatus ( 'Your bank details have been changed.' ) ; }
Add bank details.

@param \Illuminate\Http\Request $request
@return \Illuminate\Http\RedirectResponse
Add bank details .