32 lines
646 B
PHP
32 lines
646 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class ValidatorServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
Validator::extend('check_array', function ($attribute, $value, $parameters, $validator) {
|
|
return count(array_filter($value, function($var) use ($parameters) { return ( $var && $var >= $parameters[0]); }));
|
|
});
|
|
}
|
|
}
|