Author: James

James Mills > Articles by: James

Removing foreign keys from a Laravel application

I currently use Digital Ocean’s managed database for my primary database but I wanted to try out Planet Scale. When migrating a database over to Planet Scale you cannot use Foreign Keys. This got me thinking about a way to automatically generate a migration file to drop all foreign keys. If you want to jump […]

Read More

My packages are now Treeware

UPDATE: 9th January 2020I’m really pleased to say that other people are starting to add #Treeware to their packages. I have started to curate a list here. When Freek published “Our packages are now postcardware” I was intrigued to know what Postcardware was. Postcardware, also called just cardware, is a style of software distribution similar […]

Read More

Laravel & DataDog Timeseries Metric data using their API via TCP

We recently started to trial some of the DataDog services for a recent project I have been working on. One of the things that jumped out at me was the ability to use one account for many services. Monitoring, uptime, API testing, application profiling, live dashboards…. the list goes on. The setup is simple, you […]

Read More

Adding a helper file in Laravel

Every now and then you will probably find yourself in the need to use a custom function in your Laravel application. I cannot think of one project which I have worked on where I haven’t needed to add a quick and easy custom function. Our controllers don’t contain actions outside of the 7 resource actions […]

Read More

How to set Social Sharing Images

You may have noticed that when you share my blog posts on Social Media and services like Slack, Telegram and WhatsApp etc. you get to see a nice image accompanying the link to the post. Improved CTR These images really help with Click Through Rate (CTR) and I have found that engagement on the shares […]

Read More

How to return JSON from Laravel Form Request validation errors

UPDATE 10th June 2019 : I posted this article on LaravelUK Slack channel and David T gave me some valuable feedback. You can force Laravel to always return only JSON by specifying the Accept header However, there may be instances where you want to force it regardless and the below article demonstrates how to do […]

Read More