In this tutorial you will learn about the How to Use Yajra Datatables in Laravel 8 and its application with practical example.
In this How to Use Yajra Datatables in Laravel 8 tutorial, I’ll show you how to install and use yajra DataTables in your laravel 8 application with example. In this tutorial you will learn to install and use yajra DataTables in your laravel 8 application. In this example, we will be using yajra datatable package for listing of records with pagination, sorting and filter (search) feature. Laravel Yajra datatables package comes with many built-in features for searching and sorting functionality.
How to Use Yajra Datatables in Laravel 8
In this step by step tutorial I’ll guide you through the process to install and use yajra DataTables in your laravel application. In this tutorial I will demonstrate you with example installation and use of DataTables in laravel. Please follow the instruction given below:
- Install Laravel App
- Install Yajra Datatables
- Set Up Model and Migrations
- Insert Dummy Data
- Create Controller
- Define Route
- Create View
Install Laravel App
First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command
1 |
composer create-project laravel/laravel laravel-yajra-datatables --prefer-dist |
Switch into the project project directory using following command
1 |
cd laravel-yajra-datatables |
Install Yajra Datatable Package
In this step, we will install Yajra Datatables Package via the composer dependency manager. Use the following command to install Yajra Datatables Package.
1 |
composer require yajra/laravel-datatables-oracle |
After Installing Yajra Datatables package, we need to add service provider and alias in config/app.php file as following.
config/app.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
..... ..... 'providers' => [ .... .... Yajra\DataTables\DataTablesServiceProvider::class, ] 'aliases' => [ .... .... 'DataTables' => Yajra\DataTables\Facades\DataTables::class, ] ..... ..... |
Run vendor publish command further this step is optional: