Laravel Vue JS Axios Get Request Example

Hi Artisan

In this tutorial i will discuss step by step about laravel axios get request example. I have already made a tutorial on laravel axios post example some day ago. If you dont know how to make laravel axios post. Then you cam read this below article


Read : Laravel Vue JS Axios Post Request Example Tutorial


But in this tutorial i am going to show laravel axios get example. axios is a http client library. axios provide to send get, post, put, delete request with parameter, formdata, headers, string, image, multipart/form-data etc.

axios is a awesome library for http can axios git repository and have a look on it. Axios git repository So let's start our simple laravel vue axios tutorial.


In this example i will use User model to fetch data. So we no need extra model or migration.


Step 1: Laravel Installation

For completing our vue laravel axois get request example, we need a fresh laravel app. Just download it.

composer create-project --prefer-dist laravel/laravel blog


Step 2: Define the routes

Now, we need to define the API routes inside the routes >> web.php file.




Step 3 : Create Controller

To quickly create UserController, run below command

php artisan make:controller UserController 


Now open user controller and paste those following code.


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class UserController extends Controller
    public function index()

        return response()->json([

            'users' => \App\User::latest()->get()

        ], Response::HTTP_OK);



Step 4 : Install Vue dependency

Now, go inside the project folder and install the frontend dependencies using the following command.

npm install


Step 5: Setup app.js file



window.Vue = require('vue');

Vue.component('user-component', require('./components/UserComponent.vue').default);

const app = new Vue({
    el: '#app',


Read also : Laravel 6 Ajax Form Submit With jQuery Validation


Step 6 : Create UserComponent

Now we have to create user component for making axios get request example after creating user component.

just paste this below code to complete our laravel vue js axios get request tutorial.



Step 7 : Create Blade File

Now we have to create our view file to see our users table. So create it inside this following delectory



After creating some dummy users, you should see the below image


You can simply use tinker to make dummy users. Just do it

php artisan tinker
// then


Now run this below command to compile our entire javascript file

npm run dev
npm run watch

Now if you visit this below url you can see all users.




And now you are ready to check this vue axois get request example in laravel 6 tutorial. Hope i can help you.


#laravel #vue-js #get-request #example #laravel-6