...

/

Validate Quantity of Products

Validate Quantity of Products

Learn how we can validate that the number of products ordered does not exceed the number of available products.

We'll cover the following...

At the start of this chapter, we added the attribute quantity to the Product model. It is now time to validate that the quantity of product is sufficient for the order to be placed. To make things more interesting, we will do this using a custom validator.

First, ...