Command Palette
Search for a command to run...
Comments (1)
Join the discussionGood article, never realized there wasn’t an equals validation rule. I wonder if that’s something that should be in Laravel by default? Is it a use case you’ve run into often?
Sean Kegel Thank you for the comment and reading the article!
Yes, I run into it relatively often, but I like to use Validation in non-standard ways, also outside of the context of controller. Some example use cases:
- only "pending" Appointments can be completed
- Only "active" subscriptions can have scheduled generated automatically
- "Project summary" can be sent for only active projects etc.
In none of the above, I am validating form input, but rather the state of the object on which I am performing some action.
Maybe there's a better pattern to do it, but I am quite happy with using validation for that.
For more context, you can check what I wrote earlier this year on how I use validation: https://annissimo.com/using-laravel-validation-outside-of-controllers-requests
More from this blog
Cities over nature
Often when talking to people about preferred travel destinations or travel plans, I am surprised how different what I like to do is from what most people like do as travelers. For example, I genuinely
Creating a design system with Google Stitch MCP
I have been setting up Google Stitch MCP to see if I can keep a single source of truth for design documentation inside my project, and then use Stitch to generate ideas and UI prototypes from that dir
Thoughts on testing reversibility of Aristotle's law of motion in Susskind's Classical Mechanics Theoretical Minimum
The following is my attempt to decipher what Leonard Susskind communicates in Lecture 3: Dynamics of Theoretical Minimum: What You Need to Know to Start Doing Physics, when he formulates “Aristotle’s Law of Motion”, and shows that this law doesn’t ho...
How to copy a PROMPT from ChatGPT with formatting preserved after a response is generated?
When I have a really good prompt in ChatGPT that did what I wanted it to do. In particular, when it was something data-wrangling related. For example, when I supplied the prompt with JSON or HTML, or some leading spaces, and new lines. By default, af...
How to start a new Laravel project with Laravel Sail without local installation of PHP
For some reason, since Laravel 12, official Laravel docs no longer provide guidance on how to set up Laravel project locally with Laravel Sail, without having PHP available on your machine - i.e. goin