Looking to hire Laravel developers? Try LaraJobs

validator-enhancement maintained by laravelfy

Description
Laravel's validator enhancement
Author
Last update
2020/04/01 06:00 (dev-master)
License
Links
Downloads
121

Comments
comments powered by Disqus

LARAVEL-VALIDATOR-ENHANCEMENT

一个能帮你从 VALIDATOR/ 寻参/ 默认赋值 的逻辑中省代码的包。


travis-ci.svg

Install

  1. Install to your composer project
composer require laravelfy/validator-enhancement
  1. Add service provider into config/app.php 's providers config array by filling:
Laravelfy\Validator\ServiceProvider::class,

Usage

<?php
...

    public function someEndPoint()
    {
        list(
            $page,
            $page_size
        ) = request()->validate(
            [
                'page' => 'integer|default:1|min:1',
                'page_size' => 'integer|default:10|min:1|max:99',
            ]
        );

        ...
    }

License

MIT