Laravel 8 Vue JS Infinite Scroll Load More Tutorial

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

In this Laravel 8 Vue JS Infinite Scroll Load More tutorial I’ll show you how to implement Infinite scroll pagination or dynamix ajax load more pagination in laravel with Vue Js. In this tutorial you will learn to implement Infinite scroll pagination or dynamic load more pagination in laravel with Vue Js . In this step by step guide I’ll share example of Vue JS Infinite Scroll Load More pagination in laravel 8.

Laravel 8 Vue JS Infinite Scroll Load More Tutorial

In this step by step tutorial I will demonstrate to create infinite scroll or load more pagination on page scroll with vue js and laravel 8 applicatons:

  • Step 1: Download Laravel Fresh Setup
  • Step 2: Setup Database Credentials
  • Step 3: Create Migration and Model File
  • Step 4: Generate Dummy Data
  • Step 5: Add Routes
  • Step 6: Create Controller By Command
  • Step 7:  Configuration Vue JS
  • Step 8: Update app.js And Default Components
  • Step 9:  Add Vue Components on welcome.blade.php file
  • Step 10: Start Development Server

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:

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

Now, in this step we will create model and migration file. Please run the following 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 Routes

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 –

The above 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

Now, you need setup Vue js. So open your terminal and execute the following commands one by one:

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: Start Development Server

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