Datatable-8 as service with Laravel5.5

jQuery Datatable is the most famous plugin. Today I am going to show you that how you can implement jQuery Yajra Datatable as service in Laravel 5.5.

Laravel Datatable as Service

The benefits of service approach that are:

-Built-in support for DataTables Buttons (server-side processing).

-Smaller footprint for our controller.

-Artisan command available for creating our service.


Before moving on actual code, you need to install Laravel 5.5. Make sure that your PHP version is 7 or later or that.

After installing Laravel 5.5 You need to install this package and run composer update command.


Update your composer.json file and then run composer update command. After successful installation, you need to load service provider and add facade into config/app.php file.

Now you are ready to create service or controller file and then just inject Builder class. Here I created UserController.php and register my routes with web.php. Last is to create new blade file.

The first step is to register web-routes. Here is my web.php into Laravel 5.5:

Here is my controller file app/Http/Controllers/UserController.php

Of course, you can create new service file and inject it with this controller. Hope you like it for more information click here


Leave a Reply

Your email address will not be published. Required fields are marked *