Use Database Connection Strings with Laravel 8

I’ve been doing a lot of database stuff lately, and not much PHP, so when I returned to make my first Laravel project for a while, I had to check the docs to remind myself how some of this works. I noticed that the default approach to database credentials is still to use separate credentials for the host, port, and other variables. I’m using Aiven databases (because I work there and managed databases are great for demo apps as well as real ones!) which supply connection strings, but Laravel supports these too. Continue reading

The RETURNING Keyword in PostgreSQL

The RETURNING keyword in PostgreSQL gives an opportunity to return from the insert or update statement the values of any columns after the insert or update was run. I mentioned this in passing in a few of my talks that touch on PostgreSQL recently, and it often gets twitter comment so here’s a quick example of the RETURNING keyword in PostgreSQL. The newest releases of PostgreSQL are excellent and I’m seeing many teams considering moving their traditional MySQL setups over – this is just one of the extra goodies that you get when you use PostgreSQL! Let’s look at an example. Continue reading