Last active
February 3, 2019 18:38
-
-
Save orobogenius/731296d6a4040dccad0cec8494f852eb to your computer and use it in GitHub Desktop.
Extending Laravel's Validator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use App\Verifiers\RedisPresenceVerifier; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
$this->app->extend('validator', function ($validator, $app) { | |
$validator->setPresenceVerifier($app[RedisPresenceVerifier::class]); | |
return $validator; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment