Validation rules for credit card using laravel-validation-rules/credit-card package in laravel
Install package laravel-validation-rules/credit-card using composer command
Create the form request
app/Http/Requests/CardVerificationRequest.php
Import package (LVR\CreditCard) before the class (CardVerificationRequest) definition and after the namespace
Write rules and error message for validation
Type-hint the CardVerificationRequest in our Controller’s store method
Import cardVerificationRequest in controller
Store method to store the card with CardVerificationRequest
You can use laravel-validation-rules/credit-card package to validate credit card details in laravel. You can create a form request and use the controller's method with type hint to validate the provided credit card information by the user.
0 comments:
Post a Comment
Thanks