PHP Laravel 6 DataTables Tutorial

Today, We want to share with you PHP Laravel 6 DataTables Tutorial.In this post we will show you laravel 5.5 datatables tutorial, hear for yajra datatables laravel package we will give you demo and example for implement.In this post, we will learn about yajra/laravel-datatables-html with an example.

PHP Laravel 6 DataTables Tutorial

There are the Following The simple About datatables server side processing in laravel using yajra, Full Information With Example and source code.

As I will cover this Post with live Working example to develop Datatable Server Side Processing with PHP Laravel 6, so the DataTables Server-side Processing with Laravel 6 and MySQL is used for this example is following below.

Also Read This πŸ‘‰   Server-side processing Laravel DataTables

Step 1: Installing Laravel 6

Install and setup Laravel 6 Web Application

//Install and setup Laravel Project
composer create-project laravel/laravel worldwideweb --prefer-dist

//2.rename the file to .env (Configuration)
mv .env.example .env

[email protected]

Laravel Datatable Pagination Sorting and Search server side processing

Step 2: Laravel 6 model and migration

create a language model and migration

php artisan make:model Language -m


public function up()
    Schema::create('languages', function (Blueprint $table) {

php artisan migrate

Step 3: Added Fake / dummy data

php artisan make:factory LanguageFactory

use App\Language;
use Faker\Generator as Faker;

$factory->define(Language::class, function (Faker $faker) {
    return [
        'name' => $faker->sentence,
        'slug' => $faker->slug(6)

Step 4: Install Laravel 6 datatables

composer require yajra/laravel-datatables-oracle


'providers' => [

'aliases' => [
    'Datatables' => Yajra\Datatables\Facades\Datatables::class,

command to publish the config file

php artisan vendor:publish --provider="Yajra\DataTables\DataTablesServiceProvider"

Step 5: Setting up Blade File && view files


<!DOCTYPE html>
<html lang="en">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Laravel 6 Servser side DataTables Tutorial - tamilrokers</title>

        <link href="//" rel="stylesheet">
        <link rel="stylesheet" href="//">

            body {
                padding-top: 40px;
        <div class="container">

        <script src="//"></script>
        <script src="//"></script>
        <script src="//"></script>

run this command using terminal

php artisan make:controller WorldWideWebController

Step 6: Create a Laravel 6 Controller



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Yajra\Datatables\Datatables;
use App\Language;

class WorldWideWebController extends Controller
    public function index()
        return view('index');

    public function languageData()
        return Datatables::of(Language::query())->make(true);



    <table class="table table-bordered" id="language-table">
                <th>Created At</th>
                <th>Updated At</th>
$(function() {
        processing: true,
        serverSide: true,
        ajax: '{!! route('datatables.language') !!}',
        columns: [
            { data: 'id', name: 'id' },
            { data: 'name', name: 'name' },
            { data: 'slug', name: 'slug' },
            { data: 'created_at', name: 'created_at' },
            { data: 'updated_at', name: 'updated_at' }

Step 7: Laravel 6 Define a routes


Route::get('language', '[email protected]');
Route::get('get-language-data', '[email protected]')->name('datatables.language')

Web Programming Tutorials Example with Demo

Read :

Also Read This πŸ‘‰   Vue.js Page Redirect after X delay seconds


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Server side DataTable in PHP Laravel 6,MySQL and Ajax.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.