update inbox list
This commit is contained in:
38
vendor/prettus/laravel-validation/.editorconfig
vendored
Normal file
38
vendor/prettus/laravel-validation/.editorconfig
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
|
||||
[**.less]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
[**.{css,scss}]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
[**.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.html]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
[**.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[**.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = false
|
||||
|
||||
[**.md]
|
||||
indent_size = 4
|
||||
60
vendor/prettus/laravel-validation/.gitignore
vendored
Normal file
60
vendor/prettus/laravel-validation/.gitignore
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/vendor
|
||||
composer.phar
|
||||
.DS_Store
|
||||
### Composer template
|
||||
vendor/
|
||||
|
||||
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
# composer.lock
|
||||
|
||||
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
||||
|
||||
*.iml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
|
||||
|
||||
13
vendor/prettus/laravel-validation/.travis.yml
vendored
Normal file
13
vendor/prettus/laravel-validation/.travis.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
|
||||
before_script:
|
||||
- travis_retry composer self-update
|
||||
- travis_retry composer install --prefer-source --no-interaction --dev
|
||||
|
||||
script: phpunit
|
||||
21
vendor/prettus/laravel-validation/LICENSE
vendored
Normal file
21
vendor/prettus/laravel-validation/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Anderson Andrade
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
182
vendor/prettus/laravel-validation/README.md
vendored
Normal file
182
vendor/prettus/laravel-validation/README.md
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
# Laravel Validation Service
|
||||
|
||||
[](https://packagist.org/packages/prettus/laravel-validation)
|
||||
[](https://packagist.org/packages/prettus/laravel-validation)
|
||||
[](https://packagist.org/packages/prettus/laravel-validation)
|
||||
[](https://packagist.org/packages/prettus/laravel-validation)
|
||||
|
||||
## Installation
|
||||
|
||||
Add "prettus/laravel-repository": "1.1.*" to composer.json
|
||||
|
||||
```json
|
||||
"prettus/laravel-validation": "1.1.*"
|
||||
```
|
||||
|
||||
### Create a validator
|
||||
|
||||
The Validator contains rules for adding, editing.
|
||||
|
||||
```php
|
||||
Prettus\Validator\Contracts\ValidatorInterface::RULE_CREATE
|
||||
Prettus\Validator\Contracts\ValidatorInterface::RULE_UPDATE
|
||||
```
|
||||
|
||||
In the example below, we define some rules for both creation and edition
|
||||
|
||||
```php
|
||||
use \Prettus\Validator\LaravelValidator;
|
||||
|
||||
class PostValidator extends LaravelValidator {
|
||||
|
||||
protected $rules = [
|
||||
'title' => 'required',
|
||||
'text' => 'min:3',
|
||||
'author'=> 'required'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
To define specific rules, proceed as shown below:
|
||||
|
||||
```php
|
||||
|
||||
use \Prettus\Validator\LaravelValidator;
|
||||
|
||||
class PostValidator extends LaravelValidator {
|
||||
|
||||
protected $rules = [
|
||||
ValidatorInterface::RULE_CREATE => [
|
||||
'title' => 'required',
|
||||
'text' => 'min:3',
|
||||
'author'=> 'required'
|
||||
],
|
||||
ValidatorInterface::RULE_UPDATE => [
|
||||
'title' => 'required'
|
||||
]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Custom Error Messages
|
||||
|
||||
You may use custom error messages for validation instead of the defaults
|
||||
|
||||
```php
|
||||
|
||||
protected $messages = [
|
||||
'required' => 'The :attribute field is required.',
|
||||
];
|
||||
|
||||
```
|
||||
|
||||
Or, you may wish to specify a custom error messages only for a specific field.
|
||||
|
||||
```php
|
||||
|
||||
protected $messages = [
|
||||
'email.required' => 'We need to know your e-mail address!',
|
||||
];
|
||||
|
||||
```
|
||||
|
||||
### Custom Attributes
|
||||
|
||||
You too may use custom name attributes
|
||||
|
||||
```php
|
||||
|
||||
protected $attributes = [
|
||||
'email' => 'E-mail',
|
||||
'obs' => 'Observation',
|
||||
];
|
||||
|
||||
```
|
||||
|
||||
### Using the Validator
|
||||
|
||||
```php
|
||||
|
||||
use \Prettus\Validator\Exceptions\ValidatorException;
|
||||
|
||||
class PostsController extends BaseController {
|
||||
|
||||
/**
|
||||
* @var PostRepository
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* @var PostValidator
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
public function __construct(PostRepository $repository, PostValidator $validator){
|
||||
$this->repository = $repository;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$this->validator->with( Input::all() )->passesOrFail();
|
||||
|
||||
// OR $this->validator->with( Input::all() )->passesOrFail( ValidatorInterface::RULE_CREATE );
|
||||
|
||||
$post = $this->repository->create( Input::all() );
|
||||
|
||||
return Response::json([
|
||||
'message'=>'Post created',
|
||||
'data' =>$post->toArray()
|
||||
]);
|
||||
|
||||
} catch (ValidatorException $e) {
|
||||
|
||||
return Response::json([
|
||||
'error' =>true,
|
||||
'message' =>$e->getMessage()
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
|
||||
try{
|
||||
|
||||
$this->validator->with( Input::all() )->passesOrFail( ValidatorInterface::RULE_UPDATE );
|
||||
|
||||
$post = $this->repository->update( Input::all(), $id );
|
||||
|
||||
return Response::json([
|
||||
'message'=>'Post created',
|
||||
'data' =>$post->toArray()
|
||||
]);
|
||||
|
||||
}catch (ValidatorException $e){
|
||||
|
||||
return Response::json([
|
||||
'error' =>true,
|
||||
'message' =>$e->getMessage()
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# Author
|
||||
|
||||
Anderson Andrade - <contato@andersonandra.de>
|
||||
|
||||
## Credits
|
||||
|
||||
http://culttt.com/2014/01/13/advanced-validation-service-laravel-4/
|
||||
1
vendor/prettus/laravel-validation/_config.yml
vendored
Normal file
1
vendor/prettus/laravel-validation/_config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
theme: jekyll-theme-cayman
|
||||
32
vendor/prettus/laravel-validation/composer.json
vendored
Normal file
32
vendor/prettus/laravel-validation/composer.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "prettus/laravel-validation",
|
||||
"description": "Laravel Validation Service",
|
||||
"keywords": ["laravel", "validation", "service"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anderson Andrade",
|
||||
"homepage": "http://andersonandra.de",
|
||||
"email": "contato@andersonandra.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"homepage": "http://andersao.github.io/laravel-validation",
|
||||
"support": {
|
||||
"email": "contato@andersonandra.de",
|
||||
"issues":"https://github.com/andersao/laravel-validation/issues",
|
||||
"wiki":"https://github.com/andersao/laravel-validation",
|
||||
"source":"https://github.com/andersao/laravel-validation",
|
||||
"docs": "http://andersao.github.io/laravel-validation"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"illuminate/support": "~5.4|^6.0|^7.0",
|
||||
"illuminate/validation": "~5.4|^6.0|^7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Prettus\\Validator\\": "src/Prettus/Validator/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable"
|
||||
}
|
||||
449
vendor/prettus/laravel-validation/composer.lock
generated
vendored
Normal file
449
vendor/prettus/laravel-validation/composer.lock
generated
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "caaff52a4356cd6c0c596d59e304292b",
|
||||
"content-hash": "d14e88ddde968f6fa5493cd81fb44eb1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
"version": "v1.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/inflector.git",
|
||||
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
|
||||
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Common\\Inflector\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"inflection",
|
||||
"pluralize",
|
||||
"singularize",
|
||||
"string"
|
||||
],
|
||||
"time": "2015-11-06 14:35:42"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/container",
|
||||
"version": "v5.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/container.git",
|
||||
"reference": "64c728a58f35c71cbcafe3ef17eb8057965d3dbc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/container/zipball/64c728a58f35c71cbcafe3ef17eb8057965d3dbc",
|
||||
"reference": "64c728a58f35c71cbcafe3ef17eb8057965d3dbc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "5.2.*",
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Container\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Illuminate Container package.",
|
||||
"homepage": "http://laravel.com",
|
||||
"time": "2015-12-17 20:45:15"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/contracts",
|
||||
"version": "v5.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/contracts.git",
|
||||
"reference": "51b3acf96a12f5a10d767d5f2a534fed6f304235"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/51b3acf96a12f5a10d767d5f2a534fed6f304235",
|
||||
"reference": "51b3acf96a12f5a10d767d5f2a534fed6f304235",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Contracts\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Illuminate Contracts package.",
|
||||
"homepage": "http://laravel.com",
|
||||
"time": "2015-12-19 14:25:38"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
"version": "v5.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/support.git",
|
||||
"reference": "0b25fb20b0c75392b0b3848fe067275c51235e37"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/support/zipball/0b25fb20b0c75392b0b3848fe067275c51235e37",
|
||||
"reference": "0b25fb20b0c75392b0b3848fe067275c51235e37",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/inflector": "~1.0",
|
||||
"ext-mbstring": "*",
|
||||
"illuminate/contracts": "5.2.*",
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
|
||||
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.2).",
|
||||
"paragonie/random_compat": "Provides a compatible interface like PHP7's random_bytes() in PHP 5 projects (~1.1).",
|
||||
"symfony/polyfill-php56": "Required to use the hash_equals function on PHP 5.5 (~1.0).",
|
||||
"symfony/process": "Required to use the composer class (2.8.*|3.0.*).",
|
||||
"symfony/var-dumper": "Improves the dd function (2.8.*|3.0.*)."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Support\\": ""
|
||||
},
|
||||
"files": [
|
||||
"helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Illuminate Support package.",
|
||||
"homepage": "http://laravel.com",
|
||||
"time": "2015-12-07 16:09:55"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/validation",
|
||||
"version": "v5.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/validation.git",
|
||||
"reference": "19ff1e0356ecc8a4261ba00de7c8398c7c75c213"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/validation/zipball/19ff1e0356ecc8a4261ba00de7c8398c7c75c213",
|
||||
"reference": "19ff1e0356ecc8a4261ba00de7c8398c7c75c213",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/container": "5.2.*",
|
||||
"illuminate/contracts": "5.2.*",
|
||||
"illuminate/support": "5.2.*",
|
||||
"php": ">=5.5.9",
|
||||
"symfony/http-foundation": "2.8.*|3.0.*",
|
||||
"symfony/translation": "2.8.*|3.0.*"
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/database": "Required to use the database presence verifier (5.2.*)."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Validation\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Illuminate Validation package.",
|
||||
"homepage": "http://laravel.com",
|
||||
"time": "2015-12-20 16:23:15"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "1563f784900958afdb584ca82a072c578ed8a929"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/1563f784900958afdb584ca82a072c578ed8a929",
|
||||
"reference": "1563f784900958afdb584ca82a072c578ed8a929",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/expression-language": "~2.8|~3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\HttpFoundation\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-27 14:30:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "0b6a8940385311a24e060ec1fe35680e17c74497"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0b6a8940385311a24e060ec1fe35680e17c74497",
|
||||
"reference": "0b6a8940385311a24e060ec1fe35680e17c74497",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2015-11-04 20:28:58"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "7f14717150a7445f8475864d1235875dd04061fb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/7f14717150a7445f8475864d1235875dd04061fb",
|
||||
"reference": "7f14717150a7445f8475864d1235875dd04061fb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/config": "<2.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/intl": "~2.8|~3.0",
|
||||
"symfony/yaml": "~2.8|~3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "To use logging capability in translator",
|
||||
"symfony/config": "",
|
||||
"symfony/yaml": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Translation\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-18 13:48:51"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
||||
18
vendor/prettus/laravel-validation/phpunit.xml
vendored
Normal file
18
vendor/prettus/laravel-validation/phpunit.xml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Package Test Suite">
|
||||
<directory suffix=".php">./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
250
vendor/prettus/laravel-validation/src/Prettus/Validator/AbstractValidator.php
vendored
Normal file
250
vendor/prettus/laravel-validation/src/Prettus/Validator/AbstractValidator.php
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php namespace Prettus\Validator;
|
||||
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Prettus\Validator\Contracts\ValidatorInterface;
|
||||
use Prettus\Validator\Exceptions\ValidatorException;
|
||||
|
||||
/**
|
||||
* Class AbstractValidator
|
||||
* @package Prettus\Validator
|
||||
* @author Anderson Andrade <contato@andersonandra.de>
|
||||
*/
|
||||
abstract class AbstractValidator implements ValidatorInterface
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $id = null;
|
||||
|
||||
/**
|
||||
* Validator
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* Data to be validated
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* Validation Rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rules = array();
|
||||
|
||||
/**
|
||||
* Validation Custom Messages
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messages = array();
|
||||
|
||||
/**
|
||||
* Validation Custom Attributes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* Validation errors
|
||||
*
|
||||
* @var MessageBag
|
||||
*/
|
||||
protected $errors = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set Id
|
||||
*
|
||||
* @param $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data to validate
|
||||
*
|
||||
* @param array $data
|
||||
* @return $this
|
||||
*/
|
||||
public function with(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return errors
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function errors()
|
||||
{
|
||||
return $this->errorsBag()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Errors
|
||||
*
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function errorsBag()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the data and the rules to the validator
|
||||
*
|
||||
* @param string $action
|
||||
* @return boolean
|
||||
*/
|
||||
abstract public function passes($action = null);
|
||||
|
||||
/**
|
||||
* Pass the data and the rules to the validator or throws ValidatorException
|
||||
*
|
||||
* @throws ValidatorException
|
||||
* @param string $action
|
||||
* @return boolean
|
||||
*/
|
||||
public function passesOrFail($action = null)
|
||||
{
|
||||
if (!$this->passes($action)) {
|
||||
throw new ValidatorException($this->errorsBag());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rule for validation by action ValidatorInterface::RULE_CREATE or ValidatorInterface::RULE_UPDATE
|
||||
*
|
||||
* Default rule: ValidatorInterface::RULE_CREATE
|
||||
*
|
||||
* @param null $action
|
||||
* @return array
|
||||
*/
|
||||
public function getRules($action = null)
|
||||
{
|
||||
$rules = $this->rules;
|
||||
|
||||
if (isset($this->rules[$action])) {
|
||||
$rules = $this->rules[$action];
|
||||
}
|
||||
|
||||
return $this->parserValidationRules($rules, $this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rules for Validation
|
||||
*
|
||||
* @param array $rules
|
||||
* @return $this
|
||||
*/
|
||||
public function setRules(array $rules)
|
||||
{
|
||||
$this->rules = $rules;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Custom error messages for validation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
return $this->messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Custom error messages for Validation
|
||||
*
|
||||
* @param array $messages
|
||||
* @return $this
|
||||
*/
|
||||
public function setMessages(array $messages)
|
||||
{
|
||||
$this->messages = $messages;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Custom error attributes for validation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Custom error attributes for Validation
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttributes(array $attributes)
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parser Validation Rules
|
||||
*
|
||||
* @param $rules
|
||||
* @param null $id
|
||||
* @return array
|
||||
*/
|
||||
protected function parserValidationRules($rules, $id = null)
|
||||
{
|
||||
if (null === $id) {
|
||||
return $rules;
|
||||
}
|
||||
|
||||
array_walk($rules, function (&$rules, $field) use ($id) {
|
||||
if (!is_array($rules)) {
|
||||
$rules = explode("|", $rules);
|
||||
}
|
||||
|
||||
foreach ($rules as $ruleIdx => $rule) {
|
||||
// get name and parameters
|
||||
@list($name, $params) = array_pad(explode(":", $rule), 2, null);
|
||||
|
||||
// only do someting for the unique rule
|
||||
if (strtolower($name) != "unique") {
|
||||
continue; // continue in foreach loop, nothing left to do here
|
||||
}
|
||||
|
||||
$p = array_map("trim", explode(",", $params));
|
||||
|
||||
// set field name to rules key ($field) (laravel convention)
|
||||
if (!isset($p[1])) {
|
||||
$p[1] = $field;
|
||||
}
|
||||
|
||||
// set 3rd parameter to id given to getValidationRules()
|
||||
$p[2] = $id;
|
||||
|
||||
$params = implode(",", $p);
|
||||
$rules[$ruleIdx] = $name.":".$params;
|
||||
}
|
||||
});
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
80
vendor/prettus/laravel-validation/src/Prettus/Validator/Contracts/ValidatorInterface.php
vendored
Normal file
80
vendor/prettus/laravel-validation/src/Prettus/Validator/Contracts/ValidatorInterface.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php namespace Prettus\Validator\Contracts;
|
||||
|
||||
use Illuminate\Contracts\Support\MessageBag;
|
||||
use Prettus\Validator\Exceptions\ValidatorException;
|
||||
|
||||
/**
|
||||
* Interface ValidatorInterface
|
||||
* @package Prettus\Validator\Contracts
|
||||
* @author Anderson Andrade <contato@andersonandra.de>
|
||||
*/
|
||||
interface ValidatorInterface
|
||||
{
|
||||
const RULE_CREATE = 'create';
|
||||
const RULE_UPDATE = 'update';
|
||||
|
||||
/**
|
||||
* Set Id
|
||||
*
|
||||
* @param $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* With
|
||||
*
|
||||
* @param array
|
||||
* @return $this
|
||||
*/
|
||||
public function with(array $input);
|
||||
|
||||
/**
|
||||
* Pass the data and the rules to the validator
|
||||
*
|
||||
* @param string $action
|
||||
* @return boolean
|
||||
*/
|
||||
public function passes($action = null);
|
||||
|
||||
/**
|
||||
* Pass the data and the rules to the validator or throws ValidatorException
|
||||
*
|
||||
* @throws ValidatorException
|
||||
* @param string $action
|
||||
* @return boolean
|
||||
*/
|
||||
public function passesOrFail($action = null);
|
||||
|
||||
/**
|
||||
* Errors
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function errors();
|
||||
|
||||
/**
|
||||
* Errors
|
||||
*
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function errorsBag();
|
||||
|
||||
/**
|
||||
* Set Rules for Validation
|
||||
*
|
||||
* @param array $rules
|
||||
* @return $this
|
||||
*/
|
||||
public function setRules(array $rules);
|
||||
|
||||
/**
|
||||
* Get rule for validation by action ValidatorInterface::RULE_CREATE or ValidatorInterface::RULE_UPDATE
|
||||
*
|
||||
* Default rule: ValidatorInterface::RULE_CREATE
|
||||
*
|
||||
* @param $action
|
||||
* @return array
|
||||
*/
|
||||
public function getRules($action = null);
|
||||
}
|
||||
58
vendor/prettus/laravel-validation/src/Prettus/Validator/Exceptions/ValidatorException.php
vendored
Normal file
58
vendor/prettus/laravel-validation/src/Prettus/Validator/Exceptions/ValidatorException.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php namespace Prettus\Validator\Exceptions;
|
||||
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
/**
|
||||
* Class ValidatorException
|
||||
* @package Prettus\Validator\Exceptions
|
||||
* @author Anderson Andrade <contato@andersonandra.de>
|
||||
*/
|
||||
class ValidatorException extends \Exception implements Jsonable, Arrayable
|
||||
{
|
||||
/**
|
||||
* @var MessageBag
|
||||
*/
|
||||
protected $messageBag;
|
||||
|
||||
/**
|
||||
* @param MessageBag $messageBag
|
||||
*/
|
||||
public function __construct(MessageBag $messageBag)
|
||||
{
|
||||
$this->messageBag = $messageBag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function getMessageBag()
|
||||
{
|
||||
return $this->messageBag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance as an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return [
|
||||
'error'=>'validation_exception',
|
||||
'error_description'=>$this->getMessageBag()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object to its JSON representation.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
return json_encode($this->toArray(), $options);
|
||||
}
|
||||
}
|
||||
49
vendor/prettus/laravel-validation/src/Prettus/Validator/LaravelValidator.php
vendored
Normal file
49
vendor/prettus/laravel-validation/src/Prettus/Validator/LaravelValidator.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php namespace Prettus\Validator;
|
||||
|
||||
use Illuminate\Contracts\Validation\Factory;
|
||||
|
||||
/**
|
||||
* Class LaravelValidator
|
||||
* @package Prettus\Validator
|
||||
* @author Anderson Andrade <contato@andersonandra.de>
|
||||
*/
|
||||
class LaravelValidator extends AbstractValidator
|
||||
{
|
||||
/**
|
||||
* Validator
|
||||
*
|
||||
* @var \Illuminate\Validation\Factory
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param \Illuminate\Contracts\Validation\Factory $validator
|
||||
*/
|
||||
public function __construct(Factory $validator)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the data and the rules to the validator
|
||||
*
|
||||
* @param string $action
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($action = null)
|
||||
{
|
||||
$rules = $this->getRules($action);
|
||||
$messages = $this->getMessages();
|
||||
$attributes = $this->getAttributes();
|
||||
$validator = $this->validator->make($this->data, $rules, $messages, $attributes);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$this->errors = $validator->messages();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
0
vendor/prettus/laravel-validation/tests/.gitkeep
vendored
Normal file
0
vendor/prettus/laravel-validation/tests/.gitkeep
vendored
Normal file
Reference in New Issue
Block a user