Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

BadMethodCallException in address creation #12

Closed
vrenda opened this issue Sep 18, 2017 · 3 comments
Closed

BadMethodCallException in address creation #12

vrenda opened this issue Sep 18, 2017 · 3 comments

Comments

@vrenda
Copy link

vrenda commented Sep 18, 2017

https://github.com/rinvex/addresses/blob/c3fa5351972f70da8cbe49239f4895ac8a312d9a/src/Models/Address.php#L173

Hi, I have a BadMethodCallException thrown with message "Method [validateCountry] does not exist."

Stacktrace: #69 BadMethodCallException in /var/www/vendor/laravel/framework/src/Illuminate/Validation/Validator.php:1140 #68 Illuminate\Validation\Validator:__call in /var/www/vendor/laravel/framework/src/Illuminate/Validation/Validator.php:359 #67 Illuminate\Validation\Validator:validateAttribute in /var/www/vendor/laravel/framework/src/Illuminate/Validation/Validator.php:268 #66 Illuminate\Validation\Validator:passes in /var/www/vendor/watson/validating/src/ValidatingTrait.php:395 #65 Rinvex\Addresses\Models\Address:performValidation in /var/www/vendor/watson/validating/src/ValidatingTrait.php:248 #64 Rinvex\Addresses\Models\Address:isValid in /var/www/vendor/watson/validating/src/ValidatingObserver.php:51

I'm using laravel 5.5.4

I just manually require rinvex\support package (can you fix this also?) but i have not find country rule.

I need to pass $country_code in create method.

Regards,
Vito

@coding-sunshine
Copy link

I am also facing the same issue.
Did you find any solution @vrenda ?

@robbielove
Copy link

robbielove commented Jan 8, 2018

This still appears to be an issue - basically addresses can't be saved because it tries to validate the country_code field but with no method included to actually validate the country_code

The only way I have been able to get around it is to manually remove the "|country" part from the validator - however this is not the best solution as the file (addresses/src/Models/Address.php) will be overwritten when running composer install or composer update

Please fix this issue by adding a validator that works or removing the validation from county_codes until there is a way to validate it.

edit: you can save addresses by omitting the country_code from the fields - obviously this method means the country_code isn't saved/can't be changed

Omranic added a commit that referenced this issue Feb 18, 2018
* release/v0.0.3: (31 commits)
  Update changelog
  Remove not-existing validation rule usage (fix #12)
  Fix minor readme typos
  Drop Laravel 5.5 support
  Update composer packages
  Update composer packages
  Add force option to artisan commands
  Simplify IoC binding
  Update minimum required PHP version
  Add Laravel v5.6 support
  Drop useless model contracts (models already swappable through IoC)
  Typehint void method returns
  Tweak composer file
  Require PHP 7.1.0 at least
  Simplify reamde
  Remove unused namespace
  Add composer dependency roave/security-advisories
  Add PHPUnitPrettyResultPrinter
  Enforce consistency
  Add missing composer dependencies
  ...
Omranic added a commit that referenced this issue Feb 18, 2018
* release/v0.0.3:
  Update changelog
  Remove not-existing validation rule usage (fix #12)
  Fix minor readme typos
@Omranic
Copy link
Member

Omranic commented Feb 26, 2018

Fixed in 2986380

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants