Building an Invoicing App in Laravel 9 - part 1

Join us for our mini series following how we design and build a small project in Laravel and Vue. This project will deal with our invoicing - watch as we take it step by step and add features as we go! Part 1 - Setting up Laravel and our Database.

Published on 20th June, 2022

blogProgramming

Sometimes you get the itch to build more than just a website - the skills you gain from this help in your web building by being able to add more complex functionality to websites, or by branching out into building full scale applications.

I decided to use Laravel and Vue to build this application, as they are both technologies I was keen to learn more about, by building on my PHP and JavaScript knowledge - I also knew I'd need to incorporate some kind of database. Laravel works really nicely with MySQL out the box, and i felt no need to change that for a simple project.

Setting up a Laravel App

I have had a few false starts before with building applications, so Laravel was already installed globally on my computer. So I opened my code editor (VSCode) and opened a new terminal, creating a new directory using the mkdir command, and installing Laravel in there using the Laravel new command. Below is the file structure of the app when installed.

Setting up the Database

This proved to be particularly difficult when it really shouldn't have been... Using MySQL on a chromebook isn't ideal anyway, but is essentially just using it in a linux container, so no excuses. But i did lose my password from the previous time I'd done this, and found it a real struggle to change it. Once I had managed to do this after a couple of hours of trial and error, the initial migration wouldn't authenticate. My username, password and database name were all correct.

After a couple more hours of searching I came across a snippet at the bottom of a stackoverflow Q & A that stated using localhost instead of the IP address in the .env file would fix the problem. It did, but it caused another problem with authentication which I still haven't fixed....

What a pain! To get round this problem, I set up a remote database on a server I host my websites with, which took around an hour of research into remote access, and we're now up and running with all the framework required to start my project.

Requirements from my Laravel App

I was going to put a lot more in the first episode of this series, but my pain debugging and the time it took has not allowed me to get as far as I wanted. However, I thought I'd list out the app requirements here to see where we go next:

  • To be able to view clients in front end
  • To be able to send clients a pdf invoice on a recurring basis every month
  • To be able to add/edit/remove clients from the front end
  • Client data to have business name, address, email address, invoice date, invoice price and invoice description as a minimum
  • Ability to send one off invoices to existing clients

As part of getting carried away, with so much data on clients, I did think this could be extended into a Client Management System and Lead Management Tool too - but that's for another time!

I hope you enjoyed reading this, and stay tuned for further updates in the not to distant future!