Build a Monthly Subscription App with Laravel Cashier

Form Validation

We'll be validating our form using the built-in Laravel Validation. With $this->validate(), we can pass a request and an array of validation rules.

If validation passes, then everything will go along normally. If validation fails, Laravel will automatically redirect a user to the previous page and add any errors to the $errors object.

Here's a sample validation:

$this->validate($request, [
    'name'     => 'required|max:255',
    'email'    => 'required|email|max:255|unique:users',
    'password' => 'required|min:6'
]);