Please sign in or create an account to participate in this conversation. There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything! Get Started. Sign In Get Started.
- Mercys Magic: A Novel.
- The Miracle of Mercy;
- How to use exists rule validation in relationship table!
Series Browse Podcast New Discussions. Posted 2 years ago by djoks.
My current project has a User and Subscription class. Then we would have to update these strings manually. But we could always just access those values from an Eloquent instance instead:. These are nice helpers around some of the more complex validation rules to make it easier to do more complex computation within the rules.
We can now access our new rule in our form validation. So that will work fine, but again - we can do better!
[orm] Validation - Laravel Doctrine
There are a couple of ways we can do this. Now we have added all the magic sauce, lets see it in action. When we want to validate that a foreign key exists, we can simply use:. Laravel 5.
Find Or Fail? Validation Forms Keeping all your validation in a form object makes things much easier to maintain.
Exists Rule Luckily, Laravel offers a handy validation rule exists to make this easy. Exists with Foreign Key, the Stringy Way Translating this to a foreign key rule is pretty straightforward. Exactly what we were after.