Laravel8 Vue JS Tutorial #1 Installation and Setup
In this tutorial, we discuss the laravel8 tutorial with vue js, which includes the stages of installation and preparation, therefore this laravel8 tutorial with vue js is specially made and easy to understand for those of you who are just learning.
Read more : Learn laravel 8 basics for beginners # part1 Installing Laravel 8
At the time laravel version 6 came with a lot of new features added, the website made with laravel was completely overhauled and displayed a new logo. Another difference will be felt when we generate authentication components in Laravel or Scafolding using the make auth command.
In laravel 6 and above, the team from laravel removed the php artisan make:auth command, so if you want to run the authentication system automatically on laravel 6 and above, you must first install a package called laravel ui, the package is a package developed directly by laravel laravel and breaks the interface part of laravel into a separate package, with the following allowing you to switch and use other libraries.
Because previously, Laravel version 5.8, by default the Laravel application already had the required UI, namely using bootstrap and using vue.js even though not everyone would use the UI, so the team from Larvel took the initiative to change it, where in Laravel 6 and above the UI was separate and serve as a module called laravel UI.
Vue Introduction
Laravel Framework Installation
composer create-project laravel/laravel BelajarVue
Laravel and Vue Settings
To setup Laravel and Vue, we can use 2 ways: we create our own setup and we can automatically setup it when we run the commandcomposer require laravel/ui
If it's successful, it means you can do or create scaffolding templates, there are some that we can use, of course, to make scaffolding, friends, you can see in the command below:
// Generate basic scaffolding...php artisan ui bootstrapphp artisan ui vuephp artisan ui react// Generate login / registration scaffoldingphp artisan ui bootstrap --authphp artisan ui vue --authphp artisan ui react --auth
php artisan ui vue
If successful then there are the addition of several new components in the resources/js directory and the packages.json file will appear as shown below.
The packages.json file is a file that is used for javascript needs, namely on the backend or frontend, where the UI settings provide the initial settings for the development process.
Introducing Node JS in Laravel
Currently you can introduce Node JS in Laravel by using the npm introduce command. As we talked about earlier, if you have introduced Node Js, usually include npm. Therefore we can use the npm recognition command.
Before compiling css and javascript, of course, you have to install dependencies to do note packages manager (NPM). To do this we will type the following command to download all the packages:
npm install
The installation process is as follows:
The installation has been successful, all dependencies have been installed into the Laravel project, so if we look at the project there is a new folder added with the name node_modules, if we have successfully installed the dependencies, we will run the command:
npm run dev
The development stage or the building stage will be carried out by Laravel-MIX, all settings from Laravel MIX are in the resource folder for CSS and JS.
Please wait for the process to run the npm run dev command, we, you guys managed to run it, it will look like the following picture: