Laravel 5.8 Datatables Server Side Processing

Rate this post

Today, We want to share with you Laravel 5.8 Datatables Server Side Processing.In this post we will show you Laravel server side processing for Datatables, hear for jQuery Datatables and Laravel Server-side implementation we will give you demo and example for implement.In this post, we will learn about DataTables – Server-side Processing in Laravel using Yajra with an example.

Laravel 5.8 Datatables Server Side Processing

There are the Following The simple About Laravel 5.8 Datatables Server Side Processing Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel 5.8 datatables server side processing, so the laravel datatables server side pagination for this example is following below.

Free Live Chat for Any Issue

Implement DataTables server-side in laravel

include Datatables CSS file

<link rel="stylesheet" type="text/css" href=""/>

<script type="text/javascript" src=""></script>

HTML table

<div class="dsp panel-head"> 
<div class="panel-body">   
 <div class="row">         
 <table class="table table-bordered" id="company_table" style="width:100%">
			<th>Member First Name</th>
			<th>Member Last Name</th>


add javascript code



        // Data table for serverside


            "processing": true,

            "serverSide": true,


                     "url": "{{ url('allmembersList') }}",

                     "dataType": "json",

                     "type": "POST",

                     "data":{ _token: "{{csrf_token()}}",route:'members'}


            "columns": [

                { "data": "id" },

                { "data": "m_first_name" },
{ "data": "m_last_name" },
{ "data": "information" },
{ "data": "m_age" },

                { "data": "action" }


            aoColumnDefs: [


               bSortable: false,

               aTargets: [ -1 ]




create Laravel routes

Route::get('members','[email protected]');
Route::post('allmembersList','[email protected]');

create member model file


namespace App;

use Illuminate\Database\Eloquent\Model;

class Member extends Model
protected $table = 'members';
protected $fillable = ['m_first_name','m_last_name','m_age','information'];

create Demo controller file


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use PDF;
use App\Members;

class MemberController extends Controller

    function members(Request $request){
        return view('show_member_list');
    function allmembersList(Request $request){

       $columns = array( 
            0 =>'id', 
            1 =>'m_first_name',
            2 =>'m_last_name',
            3 =>'information',
            4 =>'m_age',
        $memberData = Members::count();            
        $filter_member = $memberData;
        $limit = $request->input('length');
        $start = $request->input('start');
        $order = $columns[$request->input('order.0.column')];
        $dir = $request->input('order.0.dir');
            $companys = Members::offset($start)
        }else {
            $search = $request->input('search.value'); 

            $companys =  Members::where('id','LIKE',"%{$search}%")
                            ->orWhere('m_first_name', 'LIKE',"%{$search}%")
->orWhere('m_last_name', 'LIKE',"%{$search}%")
->orWhere('m_age', 'LIKE',"%{$search}%")

            $filter_member = Members::where('id','LIKE',"%{$search}%")
                             ->orWhere('m_first_name', 'LIKE',"%{$search}%")
->orWhere('m_last_name', 'LIKE',"%{$search}%")
->orWhere('m_age', 'LIKE',"%{$search}%")
        $data = array();
            foreach ($companys as $key=>$company)
                $submemberList['id'] = $key+1;
                $submemberList['m_first_name'] = $company->m_first_name;
                $submemberList['m_last_name'] = $company->m_last_name;
                $submemberList['m_age'] = $company->m_age;
                $submemberList['information'] = $company->information;
                $submemberList['action'] = '<a href="#" class="del"><span class="glyphicon glyphicon-trash"></span> 
</a><a href="#" class="edit"><span class="glyphicon glyphicon-edit"></span></a>';
                $data[] = $submemberList;

        $member_data = array(
        "draw"            => intval($request->input('draw')),  
        "recordsTotal"    => intval($memberData),  
        "recordsFiltered" => intval($filter_member), 
        "data"            => $data   
        echo json_encode($member_data); 


Web Programming Tutorials Example with Demo

Read :

Read Also:  How to use Datatables in Laravel 5.8


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


I hope you get an idea about Laravel 5.8 Datatables Server Side Processing.
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.