Skip to content
Advertisement

Tag: validation

how to exclude a rule in laravel validation

I am building a user’s resignation inside the dashboard with Form Request Validation. it works well in store resource, but I need to exclude the password role in updating resource, so if the user leaves it empty I will store the old password my validation file Answer In this case just use ‘sometimes’ for updating password and not ‘required’. Validating

Symfony 5 using the validation to validate a new entity

I’m using Symfony 5.3.7, and using the @Assert annotations, attempting to validate a new user upon registering. Trying to understand the docs however not getting anywhere. Ideally I’d like to be able to understand how to validate an entity using these annotations. I’ve tried using a separate class, and got nowhere with understanding, although I do want to go down

PHP 8 Attributes: Is it possible to validate metadata passed to attributes or force attribute instantiation?

Playing a little bit with the new PHP 8 attributes (annotations) (https://stitcher.io/blog/attributes-in-php-8) I started to create my own ones. Simple example: Hoping that the following code would throw an BadAttributeMetadataException unfortunately it finishes successfully: Is there away to validate the metadata passed for (custom) attributes? Most probably the attributes have to be instantiated automatically somehow. Answer Everything is possible –

Visual Studio Code 1.56 PHP Validation not work

When I upgraded the VS Code from version 1.55 to version 1.56 the inline PHP validator stopped working (onType). I downgraded to 1.55 and everything works. Has anyone had this problem and how can I activate PHP validation in version 1.56? I tried HTML and JavaScript, this two validators works fine. Answer PRoblem is fixed in VS Code 1.57

Laravel 8 file upload validation fails with any rule

I want to validate a file upload but with literally any validation rule, I get “The (name of input) failed to upload.” I’ve seen this issue in a few places but none of the solutions worked for me. I’m using Laravel 8.0, php 8.0.2, and nginx/1.18.0 on ubuntu. Controller: Blade file: If I get rid of the validation rule for

Advertisement