Using Tinkerwell to working on Tinkerwell is a common use case at Beyond Code. This time, a customer with multiple licenses requested if we can make it work that all their license keys expire at the same time so that it becomes easier for them to renew all their keys at once.
All their licenses are still active but vary with their renewal date – so we decided to update all their keys. For this, we wanted to sum up all days of all their Tinkerwell licenses where they qualify for updates.
After that, we divide that by the number of licenses so that we get the number of days from now that we need to add to each key.
Before we run the command, we checked if the date is correct and used Magic Comments for this information. Magic Comments display the value of a variable during the execution of the line of code. If a line get's executed multiple times, every output is appended at the end of the line as well.
Everything looked correct, so we run the update.
With this code written in a couple of minutes, we were able to make our customer happy and it was much easier than doing all the calculations by hand and changing the values in the database. We also stored this as a Code Snippet in Tinkerwell so that we can use the code if an additional custom has the same request again.
“I use Tinkerwell all the time now. Love that app.”
Eric L. Barnes
Creator of Laravel News
“I love being able to save code as snippets or files for reuse. Having multiple tabs allows me to do what I can't in a single tinker session. Remote ssh allows me to use it on stage and production servers as well, instead of tinker.”
Mark Pruitt
Sr. Engineer Web Services
The must-have companion to your favorite IDE. Quickly iterate on PHP code within the context of your web application.
Buy now Learn more