src/lib/Http/Controllers/AccountController.php
public function postPostalAddress(Request $request)
    {
        $this->validates(
            $request->all(),
            [
                'name' => 'required',
                'street1' => 'required',
                'city' => 'required',
                'county' => 'required',
                'postcode' => 'required',
                'country' => 'required',
            ]
        );

        $pa = new PostalAddress;

        $pa->name = $request->input('name');
        $pa->street1 = $request->input('street1');
        $pa->street2 = $request->input('street2');
        $pa->city = $request->input('city');
        $pa->county = $request->input('county');
        $pa->postcode = $request->input('postcode');
        $pa->country = $this->country($request->input('country'))['alpha2'];
        $pa->added = time();

        $pa->user()->associate(Auth::user());

        $pa->save();

        return redirect('/account/postal-addresses')->withStatus('Postal address added.');
    }
public function postPostalAddress(Request $request)
    {
        $this->validates(
            $request->all(),
            [
                'name' => 'required',
                'street1' => 'required',
                'city' => 'required',
                'county' => 'required',
                'postcode' => 'required',
                'country' => 'required',
            ]
        );

        $pa = new PostalAddress;

        $pa->name = $request->input('name');
        $pa->street1 = $request->input('street1');
        $pa->street2 = $request->input('street2');
        $pa->city = $request->input('city');
        $pa->county = $request->input('county');
        $pa->postcode = $request->input('postcode');
        $pa->country = $this->country($request->input('country'))['alpha2'];
        $pa->added = time();

        $pa->user()->associate(Auth::user());

        $pa->save();

        return redirect('/account/postal-addresses')->withStatus('Postal address added.');
    }
public function postPostalAddress ( Request $ request ) { $ this -> validates ( $ request -> all ( ) , [ 'name' => 'required' , 'street1' => 'required' , 'city' => 'required' , 'county' => 'required' , 'postcode' => 'required' , 'country' => 'required' , ] ) ; $ pa = new PostalAddress ; $ pa -> name = $ request -> input ( 'name' ) ; $ pa -> street1 = $ request -> input ( 'street1' ) ; $ pa -> street2 = $ request -> input ( 'street2' ) ; $ pa -> city = $ request -> input ( 'city' ) ; $ pa -> county = $ request -> input ( 'county' ) ; $ pa -> postcode = $ request -> input ( 'postcode' ) ; $ pa -> country = $ this -> country ( $ request -> input ( 'country' ) ) [ 'alpha2' ] ; $ pa -> added = time ( ) ; $ pa -> user ( ) -> associate ( Auth :: user ( ) ) ; $ pa -> save ( ) ; return redirect ( '/account/postal-addresses' ) -> withStatus ( 'Postal address added.' ) ; }
Add a postal address.

@param \Illuminate\Http\Request $request
@return \Illuminate\Http\RedirectResponse
Add a postal address .