You are currently reading the documentation for v6, while the latest version is v8.

Validating subscribers

When integrating this package into your app you will likely build a UI where people can subscribe to your list. This package provides a validation rule that verifies that given email address isn’t already on the given email list. You can use it like this:

// in a form request

public function rules() {
   $emailList = EmailList::first();

   return [
      'email' => ['email', new Spatie\Mailcoach\Rules\EmailListSubscriptionRule($emailList)]
   ];
}

You can customize the validation error message publishing the lang files.

php artisan vendor:publish --provider="Spatie\Mailcoach\MailcoachServiceProvider" --tag="mailcoach-translations"

You’ll find the translation files in lang/vendor/mailcoach. If you need to change the English messages, you can copy the keys from one of the other translation files.