lundi 18 mars 2019

How to use a Request class to validate

How can I validate a request without the dependency injection?

I need to validate two different thing in the same posting. For example, I need to run a basic validation for an entry, but also I need to validate credit card information, the payment method could change, that's why I don't add the credit card data in the basic entry request.

In my method I have:

public method create (EntryRequest $request) {

Validator::make($request->all(), 
[rules] 
}

But I already have my rules in a CreditCardRequest. How can I apply the rules to that request?

Like Validator::make($request->all(), new CreditCardRequest())



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire