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

        $address->update($request->all());

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

        $address->update($request->all());

        return $this->respondsWithSuccess(trans('address.success_update'), route('addressBook.index'));
    }
public function update ( AddressBookRequest $ request , int $ id ) { try { $ address = Auth :: user ( ) -> findAddress ( $ id ) ; } catch ( \ Illuminate \ Database \ Eloquent \ ModelNotFoundException $ e ) { return $ this -> respondsWithError ( trans ( 'address.errors.model_not_found' ) ) ; } $ address -> update ( $ request -> all ( ) ) ; return $ this -> respondsWithSuccess ( trans ( 'address.success_update' ) , route ( 'addressBook.index' ) ) ; }
Update a given address.

@param  AddressBookFormRequest $request
@param  int $id

@return void
Update a given address .