Laravel Array Validation: All You Need To Know
While reading Laravel questions on forums, I notice a lot of questions and tricky situations with co...
We found 25 results for "validation".
While reading Laravel questions on forums, I notice a lot of questions and tricky situations with co...
In this video, I'm sharing some more rarely used tips about Laravel validation that I learned over my 5+ years with Laravel.
Let's dive into some examples of how/when you would use the same or separate Form Request classes for validation. Spoiler alert: it's mostly a personal preference.
Where to store validation rules? There are multiple ways, and I will show them in this video.
What if your customer is filling in the order form, and meanwhile the product price has changed? Or, some product becomes out of stock? We need to re-validate the quantities/prices after the submit, right? In this article, I will show you two ways: regular Laravel and more UX-friendly "live validation" with Livewire.
Laravel 5 has an awesome new function - Request Validation. It separates the logic of Validation into kind of a separate layer - Requests, which reside in the folder app/Http/Requests. After the form validation, it auto-magically shows error messages. But what if we want to customize them?
When validating forms or API requests, sometimes the rule for one field depends on values from other fields. In this tutorial, I will show you 4 different Laravel syntax examples to achieve it.
This video is a small live-coding demo project of the case where one controller method is responsible for many DB actions and should be wrapped in a transaction.
What happens if you forget to validate some input data? In this video, I will show you three examples.
Try-catch is a typical PHP/Laravel way to process the exceptions. But how do you handle PHP errors? Or, do you? Let me show you a few examples.
A set of useful Laravel validation rules
You can validate data easier, Laravel validate have lots of rule class for validation.
Automatically generate Laravel validation rules based on your database table schema!
My personal experience with checking roles/permissions in the Form Requests. Would you agree?
I want to give you a strong argument on why validation logic in the controller is a violation of DRY and SOLID principles. Would you agree?
A quick demo of dynamic validation.
One discovery I've made about validation of min/max rules in Laravel, there's one important thing you need to know.
Laravel Validation mechanism has a lot of rules provided - a field can be required, integer, IP address, timezone etc. But sometimes there is a need for a special rule which is not in that list. One example of this is when you have two fields and you need only one of them to be filled. One, or another, but NOT BOTH. Laravel doesn't have a rule for that, so let's create one!
When talking about validation, we mostly mean POST requests. But GET requests also need to be validated! In this tutorial, let's see how we can do it in a couple of different ways.
I've recently read a Laracasts forum post with a question about validating a date period. Decided to write this article with a possible solution.
Laravel Validation system has 60+ validation rules available, but what if you want something extra? You can easily create your own validation rule, or use something already available on the internet. Let's take a look.
Laravel Validation returns an error as a JSON response with the error messages in a strict standard format. What if you want to change it to an entirely different structure because your front-enders ask you for specific key-value pairs?
If you have a form separated into a few tabs with jQuery UI Tabs, then default Laravel validation will redirect you back to the first tab, even if the error was on the third tab. How to override it and set the correct tab proactively?
A short list in "Did you know...?" style. Laravel has a convenient validation mechanism, but most of us only use simple rules like 'required', 'email' or 'date'. Actually, there are a few less-known but pretty interesting ones. Let's have a look.