I havent really found any tutorial that would handle a real world example of building a simple little CMS in Laravel, with an API that is consumed by some Vue components, so I decided to write up this multipart tutorial on how I would approach something like this.
First of all, you need to have some knowledge on how to work in Laravel and Vue, as this tutorial wont cover the basics on installing dependencies with Composer and NPM, setting up asset resources, preparing your environment etc. I will only give you a list of the requirement for your dev environment, and also this tutorial will be done on OSX, so if you’re working on a Windows or Linux machine there may be some differences, but I wont cover those here. Also I will create a git repository on Github with all the code.
Here’s the list of the requirements:
- PHP 7 environment (pick either Vagrant, MAMP, WAMP, LAMP, Docker etc.) I like to use Vagrant with Homestead
In the first part of the tutorial we will focus on setting up the project and building a simple API in Laravel 5.5 with proper authentication. So the first step is to create a new Laravel project. You can do this by downloading Laravel, via Composer or as I like to it, via the laravel new command:
laravel new blog
Now we need to setup a local development domain, create a database and link it all up so you end up having the site running at eg. http://blog.app
I will not go into details since there are a lot of tutorials on setting up a Laravel 5.5 application.