Changing Laravel’s default public directory

Sometimes on the servers I work on I need to change the “public” directory to “content.” To do this I create my own “Application.php” class, extending Laravel’s Application class and override the publicPath method.

Next, I update bootstrap/app.php and create the $app instance using my Application class.

I don’t use server.php but, if you did, you’d need to update the following lines in your public directory’s index file too:

Configuring PHPStorm to run PHPUnit Tests with Homestead

I use PHPStorm to run my local server with the Homestead virtual machine on Vagrant. In the past all my testing was command line but I thought, “Wouldn’t it be great to use PHPStorm’s testing features?” So, after much Googling and failing here’s a video on how to run tests on a remove server, even Homestead, using PHPStorm’s tools.

The steps:

  • Configure Server in “Deployment” settings
  • Setup your project’s CLI Interpreter to use this Server
  • Setup PHPUnit in PHPStorm to run tests through the CLI configuration and use your phpunit.xml file for config.

Creating an on page Delete Link for a Laravel record in jQuery

*My code snippets plugin seems to be crapping out. Apologies for the formatting. Will try to fix soon.

When creating CRUD pages we’ll eventually need to create delete links for records. In Laravel these links need to fire a post request to an endpoint with two fields:

  • _method which is DELETE
  • _token which has the csrf token

Here’s bit of jQuery code I put together for a recent project to help with this. Once in place, you’ll only need to create a delete link and give it the data-delete attribute with the value of the URL endpoint. Here’s how to use it:

and here is the Javascript to make it all work:

PHP Basics: str_replace

PHP’s str_replace function can by used to find/replace characters in a given string. Check out the video for more. You can learn more about str_replace on php.net.

I’ve decided to do some videos cover very basic PHP functions. While this isn’t useful for seasoned developers, I once was new to all this stuff and completely confused by everything I read. With that in mind, I hope this series of videos helps those of us that are just starting out.

Borderlist – I made a thing

So listen, I made a thing. Yes, it is another to do app thingie but this one is built a bit differently. I work from so many lists on any given day that it is difficult to see everything at a glance.

I want to

  • See multiple lists at a time around the same topic.
  • Make a list, add some items, get stuff done, tick’em off.
  • Delete lists and clear my boards.
  • See it all on my phone without having to download yet another app.

No bells and whistles. No fluff.
I want a disposable Post-It Note system without all the sticky pads.

With these goals in mind I built Borderlist. It’s free, simple, and I use it every day.

Visit Borderlist

Because this is a tech blog, here are some nerdy details. The front end is built with Bulma (CSS) and, once in an account, it is all Vue using a Laravel based API to handle the data.

If you decide to give it a try, let me know what you think.