Looking to hire Laravel developers? Try LaraJobs

laravel-rule-getter maintained by hareku

Description
Laravel get valitation rules helper.
Author
Last update
2017/06/14 10:17 (dev-develop)
License
Links
Downloads
21

Comments
comments powered by Disqus

Laravel Get Validation Rules Helper

This package helps you to get validation rule so easily.

Caution

  • Support Laravel 5.4~
  • Required php >=7.1

Installation

First, pull in the package through Composer.

Run composer require hareku/laravel-rule-getter

And then, include the service provider within config/app.php.

'providers' => [
    Hareku\LaravelRule\ValidationRuleServiceProvider::class,
];

Publish the config file. (validation-rules.php)

$ php artisan vendor:publish --provider="Hareku\LaravelRule\ValidationRuleServiceProvider"

Setting is completed!

Usage

Get a validation rule.

// validation-rules.php

return [
    'user' => [
        'name'     => 'required|min:1|max:20',
        'email'    => 'required|email|max:255|unique:users',
        'password' => 'required|min:6|max:100|confirmed',
    ],
];


// You can get with a helper function.

rule('user.name') // 'required|min:1|max:20'
rule('user.email') // 'required|email|max:255|unique:users'
rule('user.password') // 'required|min:6|max:100|confirmed'

License

MIT

Author

hareku (hareku908@gmail.com)