Laravel 7 Vue JS Infinite Scroll Example Tutorial

In this tutorial you will learn about the Laravel 7 Vue JS Infinite Scroll Example Tutorial and its application with practical example.

In this Laravel 7 Vue JS Infinite Scroll Example Tutorial I’ll show you how to create Infinite Scroll with Vue Js in laravel. In this tutorial you learn to create or implement Infinite Scroll with Vue Js in laravel application.

Step 1: Download Laravel Fresh Setup

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Setup Database Credentials

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Create Migration and Model File

Now, in this step we will create model and migration file for form. Please run the following command:

This command will create post model, migration, and factory file into your project. Now, Go to app/database/migrations and find posts migration file. Then open it and update the following code into your posts migration file:

Now, run the migration to create database table using following artisan command:

Step 4: Generate Dummy Data

Next step, generate fake or dummy data for posts table. So go to database/factories folder and find PostFactory.php file. After that, open and update the following code in PostFactory.php file as follow:

Next open terminal and run following command to generate dummy data for posts table:

Step 5: Add Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 6: Create Controller By Command

Now, lets create a controller named PostController using command given below –

This command will create PostController inside app/Http/Controllers/ folder. Now, open your PostController and update the following methods into your PostController File:

Step 7:  Configuration Vue JS

Install npm:


Install vue-resource:


Install vue-infinite-loading:

Step 8: Update app.js And Default Components

Go to resources/assets/js/ folder and find the app.js file inside this directory. Then update the following code into your app.js file:

resources/assets/js/app.js

resources/assets/js/components/ExampleComponent.vue

Step 9:  Add Vue Components on welcome.blade.php file

Go to resources/views and find welcome.blade.php file inside this folder. Then update the following code into your welcome.blade.php file:

And also update the following code into app.blade.php file, which is located on resources/views/layouts/ folder.

Step 10: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

In this tutorial we have learn about the Laravel 7 Vue JS Infinite Scroll Example Tutorial and its application with practical example. I hope you will like this tutorial.