hareku/laravel-rule-getter

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel get valitation rules helper.

1.0.4 2017-06-14 08:17 UTC

This package is not auto-updated.

Last update: 2020-11-06 00:52:36 UTC


README

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)