Laravel Validator Extend Custom Redirect
I am trying to register a custom validation rule but it does not seem to work. I need either of 2 fields to be filled in. One is a URL(link) field and other is a File input(file_upload).Here is my custom validation:
- Laravel 5.5 Validation Example. Laravel 5.5 ships with Custom Validation Rules. So it is Laravel 5.5 Validation With Custom Rules Example From Scratch. We start this tutorial by installing the Laravel and then create a form and apply the validation.
- For that Laravel provide us with a simple and powerful interface, the first thing is to extend the Validator class from Laravel framework. Creating a custom validator class. The first thing is to create new class and extends the Laravel Validator (a custom validator is a class anywhere in your project).
Laravel 5.5 will introduce support for custom validation rule objects as an alternative to using Validator::extend for custom validation rules. To define a custom validation rule, implement the Illuminate Contracts Validation Rule interface or use a Closure. The custom rule is then used directly in a validator.

Need help :)
How to block computer location. “The still runs and executes the program, but users aren’t bottlenecked to a single provider,” he said.If everything goes according to plan, users will be paid to run these programs on all sorts of devices, say if people have free space on their laptops, smartphones or even Internet of Things devices using Crowd Machine’s so-called “Crowd Computer,” set to be released in the final quarter of 2018.“That’s where the crowd computer was born,” Gorlick said.But, is this really a bottleneck for users? Under the hood, every time a users updates the calendar, in what’s called an “activity,” the developer is charged.Gorlick thinks this setup is a “bottleneck” that leads to lot of waste.The efficiency of Crowd Machine, Gorlick said, comes from breaking each of these activities into a bunch of pieces then shooting them off to a network of devices that each computes them together. Gorlick offered the example banks using AWS have to reconcile their databases at the end of every day, a process that takes about an hour with platforms like AWS.“What we figured out if we didn’t need to depend on a single providers to many devices.
EDITED
Also, I just noticed that the validation rule should accept 'PSD' files but when I try to upload a PSD file it redirects with the error 'Invalid file type'.
Laravel Validator Extend Custom Redirect Site
Lucky SoniLucky Soni3 Answers
I am maybe late in party but may be somebody will find it useful, in case you need to create implicit rule which will be called even if field is not present in Input (like required,required_if..) use
manishmanishI was just struggling with this myself! It turns out that except when a few specific rules are applied to them, Laravel doesn't pass empty fields through the Validator at all. So a custom either-this-or-that rule can't work, since at least one of the two fields is likely to not be visible to it.
You can get around this by moving from the registering-a-new-rule approach to the alternate extend-the-Validator-class approach. Your new class will inherit all the methods of the standard Validator, including a method called 'implicit' (you can find the original on line 215 of the standard Validator class), which specifies a whitelist of rules that Laravel should pass fields along to even if they are empty. Add your new rule to that list and you should be good to go.
Jason is right, but there is one thing that can be confusing.
Laravel's 'registering a new rule' approach uses the syntax 'Validator::extend(..'. As described elsewhere, this is convenient when you want to customize in a special situation. However, if you want to add a number of reusable rules, then you probably want to use the extend-the-Validator-class approach. In that case, IF you have a rule conditionally requires something, you need to override the existing implicitRules array with a new one adding your rule.
If the first rules you add don't conditionally require, you will think you have it nailed, then you will spend hours trying to figure out why your new 'RequireWhenBlaBla..' rule is invisible.