LaravelPackages.net
Acme Inc.
Toggle sidebar
csuilong/luosimao-captcha

Luosimao Validator for Laravel 5 能用的我更新过了

18
0
V2.0.1
About csuilong/luosimao-captcha

csuilong/luosimao-captcha is a Laravel package for luosimao validator for laravel 5 能用的我更新过了. It currently has 0 GitHub stars and 18 downloads on Packagist (latest version V2.0.1). Install it with composer require csuilong/luosimao-captcha. Discover more Laravel packages by csuilong or browse all Laravel packages to compare alternatives.

Last updated

Luosimao

A Luosimao Validator for Laravel 5.

Installation

Add the following line to the require section of composer.json:

"require": {
  "pokeguys/laravel-luosimao-captcha": "dev-master"
}

Setup

  1. In /config/app.php, add the following to providers:
'providers' => [
    // Other Service Providers

    Pokeguys\Luosimao\LuosimaoServiceProvider::class,
],

and the following to aliases:

'aliases' => [
  // Other Aliases

  'Luosimao' => Pokeguys\Luosimao\Facades\Luosimao::class,
],
  1. Run php artisan vendor:publish --provider="Pokeguys\Luosimao\LuosimaoServiceProvider".
  2. In /config/luosimao.php, enter your Luosimao public and private keys.
  3. The package ships with a default validation message, but if you want to customize it, add the following line into resources/lang/[lang]/validation.php:
[
  // Other validation message

  'luosimao' => 'The :attribute field is not correct.',
]

Usage

In your validation rules, add the following:

$rules = [
    // ...
    'luosimao' => 'required|luosimao',
];
        $this->validate($request,[
            'luotest_response' => 'required|luosimao',
        ],[
            'luotest_response.required'  => '请点按验证码!',
            'luotest_response.luosimao'  => '验证码错误,请重试。',
        ]);

It's also recommended to add required when validating.

Comments