Today I've been playing around with using Laravel Dusk to test a payment form on a small website.
The payment form is a key part of the owner's business so it's crucial it works all the time, whenever the customer makes a purchase.
The site uses Stripe Elements to let the customer enter their payment information securely.
Elements creates its own iframe element which makes it a little tricky to target and test. However, there's a handy method in Dusk which allows you to type inside of an iframe.
$this->browse(function ($browser) {
$browser->type('@input', 'whatever')
->withinFrame('.__PrivateStripeElement iframe', function ($browser) {
$browser
->type('[placeholder="Card number"]', '4242424242424242')
->type('[placeholder="MM / YY"]', '0923')
->type('[placeholder="CVC"]', '123');
});
});
Anything you need to type inside of Stripe's iframe you can do inside the withinFrame
method and target the relevant inputs via their placeholders.
Hopefully someone finds that helpful! 🙂
If you're slicing a design from a designer in Sketch, you may find some horizontal/vertical red bars. Here's a quick little how-to on how to get rid of them.
- Go to the Sketch artboard with the red bars
- Go to
View
in the top Sketch menu, in the dropdown, hover over Canvas
and then Layout Settings
.
- You'll see something like this:

- Uncheck
Columns
and Rows
, then press Confirm
and hey presto, bars are gone!
I'm going to presume you already have Valet and Homebrew setup. To install Imagick, there's a couple of commands you'll need to run:
brew install imagemagick
brew install pkg-config
(also if it's already done)
pecl install imagick
valet restart
In case you get a Connection Timeout when visiting one of your Valet sites, you may need to reinstall Valet with valet uninstall && valet install && valet park
.
I did something a bit stupid yesterday... I was playing around with Firewall rules on my Forge server. I setup a rule so that the only place I can SSH into my server was from my home IP Address.
However, as soon as I did that, I realised that I could not longer deploy code or do anything via Forge on that server. Then I realised my mistake.... I blocked Forge's IP Address from SSH'ing to my server.
In case someone else finds them in my position, here are the two commands I ran to fix the issue. Of course, you need to SSH to run them.
sudo ufw allow from 159.203.161.246 to any port 22
sudo ufw allow from 159.203.163.240 to any port 22
Forge uses ufw
under the hood to manage firewall rules so that's what I used to manually give Forge back control. The two IP addresses I listed in those commands link up to the IP addresses from their documentation.
A few weeks ago today I finally launched the first version of Simple Commerce.
If you've not been following me for very long, Simple Commerce is the e-commerce addon I've been building for Statamic.
If I remember correctly, I started prototyping what Simple Commerce could look like in late November/early December last year (when it was in private alpha) and started working on it properly in January/February time. I even rebuilt the addon about a gazillion times but more about that in a minute.
Read more →
Recently, I had to build out a help site for a client. One of the features in site was for the user to be able to like help article or forum posts. I managed to build it out reasonably quickly, I think it took me a day to get everything working.
I was thinking that this sort of addon would be a good candidate for building in a blog post. So that's exactly what I've done. It goes through each step of process, from bootstrapping the addon in Statamic's command-line to creating a small little front-end component for likes.
Read more →
I'm in the process of moving all of my AWS stuff into it's own account, separated from my online shopping account. It's a process that has to be done manually as AWS don't have an easy way of moving resources between accounts.
Anyway, to stop you trolling through Amazon's horrible documentation to get this ugly job done. Here's some simple instructions on moving files between buckets and AWS accounts.
Read more →
The Statamic 3 beta has been out since the middle of November if I can remember correctly. V3 basically turns it into a package for Laravel rather than a pre-built Laravel app. This is the change which allows for Statamic add ons to finally become Laravel packages.
I’m gonna quickly give you a walk through of how you get started building an addon, including setting up the environment.
Read more →
So I recently created a service worker for one of my apps so I could turn it into a Progressive Web App.
Although, for some reason I was under the impression that I should cache the main page of my app. I later realised that it was a very bad idea.
I think I'm the only user of the site that came across this issue before I patched it but I found it quite a pain to unregister the service worker and bust it's cache so I could get the latest version of the page from the server.
I had to do this process on both my MacBook and on my Android phone, so here's both of those processes:
#Chrome on the MacBook
The first thing to do is to open up Developer Tools and head to the 'Application' tab. In there it has its own little sidebar. Go to the 'Service worker' part of that. There it should give you the option of 'Unregistering' your service worker. Click on that link and also go and clear the whole site's cache because why not.
#Chrome on the Android phone
The first thing to do is to go to the site, tap on the site's security padlock (or warning sign ⚠️) and tap on Site settings
. Then tap on Clear & reset
. Then just refresh the page and you should be good to go!