Laravel 11 Yajra Datatables Example

Laravel 11 Yajra Datatables Example

Today, We will discuss about how to use yajra datatable in laravel 11. We can easily searching, pagination, and ordering the data using this datatable.

yajra datatable is an oracle package and it provides facility like as sorting, searching, pagination and ordering. it is given a quick response data because it’s used ajax and it’s layout very nice therefore user often use.

Now, We will create yajra datatable using below step in laravel 11.

Now, we follow the below step for creating the Laravel 11 Yajra Datatables Example.

Overview

Step 1: Install Laravel 11
Step 2: MySQL Database Configuration
Step 3: Create Migration Table
Step 4: Install Yajra Datatable
Step 5: Add Dummy Data
Step 6: Create Route
Step 7: Create Controller and Model
Step 8: Add Blade Files
Step 9: Run Laravel Application

Step 1 : Install Laravel 11

We are going to install laravel 11, so first open the command prompt or terminal and go to xampp htdocs folder directory using the command prompt. after then run the below command.

Step 2: MySQL Database Configuration

After complete installation of laravel. we have to database configuration. now we will open the .env file and change the database name, username, password in the .env file. See below changes in a .env file.

Step 3: Create Migration Table

Now, We need to create a migration. so we will below command using create the students table migration.

After complete migration. we need below changes in the database/migrations/create_students_table file.

Run the below command. after the changes above file.

Step 4: Install Yajra Datatable
In this step, we will intall yajra datatable using the below command.

Step 5: Add Dummy Data
In this step, we will add dummy data into database using the below commmand.

Step 6: Create Route

We have to need put below route in routes/web.php file.

Step 7: Create Model and Controller

Here below command help to create the controller and model.

Student.php

StudentController.php

Step 7: Add Blade Files

So finally, first we will new file of “students.blade.php” in the “resources/views/” directory.

resources/views/students.blade.php

Step 8: Run Laravel Application
We can start the server and run this example using the below command.

Now we will run our example using the below Url in the browser.

laravel-11-Yajra-datatables-example_list
if you want to download source code then you can visit below link url for source code example github.

Download code from github