There might be times when we need to validate our forms for something that's not part of the framework. This recipe will show you how to build a custom validation rule and apply it.
The following are the steps to complete this recipe:
In the
views
directory, create a file namedvalid.php
to hold our form using the following code:<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Custom Validation</title> </head> <body> <p> <?php if ($errors): ?> <?php echo $errors->first('email') ?> <?php echo $errors->first('captain') ?> <?php endif; ?> </p> <p> <h3>Custom Validation</h3> <?= Form::open(array('url' => 'valid', 'method' => 'post'))?> <?= Form::label('email', 'Email') ?> <?= Form::text('email...