/** * Bootstrap any application services. * * @return void */ public function boot() { //this custom validator Validator::extend('unique_email', function ($attribute, $value, $parameters) { $user = new User(); $userCollection = $user->getCollection(); $result = $userCollection->findOne(['email' => $value], ['email']); if (!$result) { return true; } return false; }); }