I was going through some of my morning feeds and there was a question on where validation should be done. In Laravel you have three good options to choice from. You can do your validation in your controller, in the model or in Form Requests. The things I hate most about doing the validation in the controller is the consistency in the rules I write. So in one post someone did a simple thing in their model. They simply added a static property to their models that had their rule set. It was simple and at the time time, I somehow missed it as an option. So if you don’t want to use the Form Request or do any validating in the model, you can add the ruleset property to your model to keep it consistent across your controller.
This initial post is not a detailed comparison between the two at this time but a way to keep me on track with blogging. I have started working on a few personal projects that I hope will turn into something more than just a hobby. I like Laravel but have struggled to find the best environment to develop with. At work we have our own AWS instance for each developer that we can push code to, but that involves having to either pushing to git and then cloning down, or doing what I do, and push changes using PHPStorm deployment process. Either way takes just a little bit of time to have the code in a environment that can be tested. So to solve this problem, I have been testing out both Docker and Homestead.
Currently I am running a Dell Laptop with 8GB of RAM, so running either solution is working out really well. I also use OneDrive to Sync. the folder with all of my development code due to past experience. I do use GitHub and BitBucket but I don’t always throw my prototype code in a Repo until I am further along. This has cost me some time in the past, so OneDrive it is.
I have played around with Docker and I do like the way it is setup After searching the internet for tutorials and quick starts, I did find https://github.com/laradock/laradock which got me moving pretty quick. I started my project and everything was going fine. It boots pretty quick, not overly resource intensive and I was able to switch technologies pretty fast. The problem I am having is OneDrive is not liking docker and it was causing sync issues and not updating the code for Docker. I have not sat down to find a solution, so I may have to come back to this at a later date.
The reason I started trying out Homestead was the fact I like Laravel and since this was setup for the framework, it works out really great. So far I have not had any issues with OneDrive and for my needs for local development, it is great. With the use of Vagrant and Virtualbox you do see more resources being chewed up, plus it does take a little longer to boot up. I did set it up as a per project installation so that I can have different configurations if the need arises.
I am still trying to explore both as a development platform and not a production platform, so we will see where it leads me. With Homestead I know I am working in the same environment that Forge uses for it’s deployments, so I should never have a big surprise.