laravelfy/validator-enhancement

Laravel's validator enhancement

v0.11 2020-04-01 04:00 UTC

This package is auto-updated.

Last update: 2024-10-29 05:22:40 UTC


README

一个能帮你从 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