public function setDefault(Request $request)
    {
        try {
            $address = Auth::user()->findAddress($request->id);
        } catch(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return $this->respondsWithError(trans('address.errors.model_not_found'));
        }

        Auth::user()->resetDefaultAddress();

        $address->update(['default' => true]);

        return $this->respondsWithSuccess('', route('addressBook.index'));
    }
public function setDefault(Request $request)
    {
        try {
            $address = Auth::user()->findAddress($request->id);
        } catch(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return $this->respondsWithError(trans('address.errors.model_not_found'));
        }

        Auth::user()->resetDefaultAddress();

        $address->update(['default' => true]);

        return $this->respondsWithSuccess('', route('addressBook.index'));
    }
public function setDefault ( Request $ request ) { try { $ address = Auth :: user ( ) -> findAddress ( $ request -> id ) ; } catch ( \ Illuminate \ Database \ Eloquent \ ModelNotFoundException $ e ) { return $ this -> respondsWithError ( trans ( 'address.errors.model_not_found' ) ) ; } Auth :: user ( ) -> resetDefaultAddress ( ) ; $ address -> update ( [ 'default' => true ] ) ; return $ this -> respondsWithSuccess ( '' , route ( 'addressBook.index' ) ) ; }
Setting to default a given address.

@param Request $request
Setting to default a given address .