antonamosov/laravel-math-captcha
最新稳定版本:1.1.1
Composer 安装命令:
composer require antonamosov/laravel-math-captcha
包简介
A simple math captcha for Laravel form validation with different operations.
README 文档
README
Installation
composer require antonamosov/laravel-math-captcha
Setup Laravel > 5.5
This package supports Laravel Package Auto-Discovery.
Setup Laravel <= 5.4
You can add the ServiceProvider to the providers array in app/config/app.php.
ElicDev\MathCaptcha\MathCaptchaServiceProvider::class,
Usage
This package only returns the question and the input. You have to position it within your labels and form classes.
{{ app('mathcaptcha')->label() }}
{!! app('mathcaptcha')->input() !!}
Display it wihtin Bootstrap as example:
<div class="form-group">
<label for="mathgroup">Please solve the following math function: {{ app('mathcaptcha')->label() }}</label>
{!! app('mathcaptcha')->input(['class' => 'form-control', 'id' => 'mathgroup']) !!}
@if ($errors->has('mathcaptcha'))
<span class="help-block">
<strong>{{ $errors->first('mathcaptcha') }}</strong>
</span>
@endif
</div>
Looks like
Validation
Add 'mathcaptcha' => 'required|mathcaptcha' to rules array.
$this->validate($request, [ 'mathcaptcha' => 'required|mathcaptcha', ]);
Add corresponding translation string to your lang/validation.php files.
Reset
This package does not generate a new math question for each request. Once the form has been submited without validation erros you can reset the library to force generate a new question.
app('mathcaptcha')->reset();
统计信息
- 总下载量: 61
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-17
