If you're in a loop you may implode
In Blade files, we have a number of useful directives. Laravel decorates some of them with additional properties to make our life even easier.
Page 9 of 76 - keep going...
In Blade files, we have a number of useful directives. Laravel decorates some of them with additional properties to make our life even easier.
When projects don’t have a proper set up of dev data using Laravel seeders, getting started can be kind of tough. And if you can help it, you really don’t want to be pulling data from production. User data is precious and should be protected! So what kind of package or utility could help us here? Let me detail out my thoughts - maybe it’s something you want to build!
As a contractor, I go into a lot of projects. Sometimes these are set up perfectly and other times they need a bit of work for me to be effective and efficient. Some clients are willing to accept updates for tooling, others don’t have the time, budget or ability to accept these updates. So, how can I use my tools - which require configuration files - without editing their project? Actually, git has a nice built-in functionality that will work perfect for this - and it’s not the .gitignore file.
You’re using Pull Requests in GitHub and everything is working great! Nice workflow! But now you have a problem: deploying from develop to main via a … what? A PR? A merge commit if you bring the two branches down to your local machine? What else? What about a GitHub action that you can use to do this? Here’s a simple proof of concept with explanation - you may still need to alter this for your workflow.
Sometimes you want to set up a new project with a domain, but you don’t want to set up the whole email infrastructure. You could ignore the email, and hope people can track you down. Or you can add a catch all email at your domain to gather attempts from people to contact you. I opt for the second. Turns out there’s a free and easy way to do it on Cloudflare. Next steps below with screenshots.
When using the Docker MySQL Container, you can specify files in the /docker-entrypoint-initdb.d folder to be imported or ran when the container is brought up. These can be in the form of .sql, .sql.gz or .sh - and get ran after the database is up but before its accepting connections.
But what if you can’t seem to get these to run again? The fix is just so annoyingly simple.
I love using Laravel Database Factories for setting up test data. But, what about when we want to do more complex domain object creation besides just data values or relationships created outside of the factory? Let’s try using the afterCreated() hook and states.
To whom it may concern… and that person probably is me… here is a list of the 50 US states in array form, nice and easy to copy+paste into your PHP code.
There are a number of tools and packages that help you manage your users and their associated password reset flows available. The Laravel docs also describe a way that you can reset your password in your own controller. Depending on the use case of the application, I end up having to use code like this in some applications when other packages won’t work as drop-ins. But, can we make this example a little better, more secure, easier to read or a better UX? I think so. Let’s go.
Elevator pitches for startups and products are hard. What if there was an online tool where you could go to practice just that?