From 9036b8a3f30fae86e6db0f05bcee514cc9f4f9c1 Mon Sep 17 00:00:00 2001 From: pixelpeter Date: Fri, 15 Mar 2019 18:04:24 +0100 Subject: [PATCH] UPDATE: README.md, CHANGELOG.md --- .travis.yml | 1 + CHANGELOG.md | 28 ++++++++++++++++++++++++++++ README.md | 30 ++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c353fca..f31e298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php php: - 7.1 - 7.2 + - 7.3 matrix: include: diff --git a/CHANGELOG.md b/CHANGELOG.md index ba56931..6e1ef9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,34 @@ All Notable changes for the Laravel 5 IsoCodes Validation will be documented in this file +## 3.0.0 +- Fix issue #8: missing function replaceVat +- Laravel 5.8 +- Upgrade to phpunit 7.5.x +- Add php 7.3 to travis-ci +- Add support for arrays with dot notations to all validation methods + ```php + $payload = [ + 'data' => [ + [ + 'country' => 'DE', + 'zipcode' => 63741 + ], + [ + 'country' => 'AT', + 'zipcode' => 1180 + ] + ] + ]; + + $validator = Validator::make($payload, [ + 'data.*.zipcode' => 'zipcode:data.*.country' + ]); + ``` +- Refactor: fix scrutinizer issues +- Refactor: add (external) fixtures to tests to reduce number of lines +- Refactor: remove unused function params + ## 2.0.0 - Laravel 5.5 compatibility with Auto-Discovery - Require php 7.0+ diff --git a/README.md b/README.md index 58ef4d8..6045f89 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ A simple Laravel 5 wrapper for the [IsoCodes Validation library](https://github. composer require pixelpeter/laravel5-isocodes-validation ``` -### Step 2: Add the Service Provider (not needed with v2.x because of auto discovery) +### Step 2: Add the Service Provider +*(not needed starting with v2.x because of auto discovery)* + Add the service provider in `app/config/app.php` ```php 'provider' => [ @@ -44,7 +46,7 @@ $rules = [ $validator = Validator::make($payload, $rules); ``` -### Examples with parameter +### Examples with reference parameter Some rules need a reference to be validated against (e.g. `country` for `zipcode`). Just pass the name of the field holding the reference to the rule. @@ -73,6 +75,30 @@ $rules = [ $validator = Validator::make($payload, $rules); ``` +### Example with arrays and dot notation +*(added in v3.x)* + +As suggested by @otr-tomek I've added support for all validation methods using arrays in dot notation as an input. + +```php +$payload = [ + 'data' => [ + [ + 'country' => 'DE', + 'zipcode' => 63741 + ], + [ + 'country' => 'AT', + 'zipcode' => 1180 + ] + ] +]; + +$validator = Validator::make($payload, [ + 'data.*.zipcode' => 'zipcode:data.*.country' +]); +``` + ### Validation error messages Error messages can contain the name and value of the field and the value of the reference ```php