How to use Datatables in Laravel 5.8

In this tutorial, I will show you how to use the Datatables in the Laravel based project withyajra/laravel-datatables-oracle package. For this tutorial, we gonna use Laravel 5.8 version but the Datatable package usage steps will be pretty simpler with other versions of Laravel framework.

As a first step lets setup a brand new Laravel project with below composer command.

composer create-project --prefer-dist laravel/laravel datatablesExample

Above command will create a Laravel project with in a folder called datatablesExample

After creating the project, we need to install yajra/laravel-datatables-oracle composer package with below shown composer command. This package is created to handle server-side works of DataTables jQuery Plugin via AJAX option by using Eloquent ORM, Fluent Query Builder or Collection.

composer require yajra/laravel-datatables-oracle

Now register provider and facade in the application, to do that open your
config/app.php file and add the following lines to the providers and aliases array as shown below.

.....
'providers' => [
	....
	Yajra\DataTables\DataTablesServiceProvider::class,
]
'aliases' => [
	....
	'DataTables' => Yajra\DataTables\Facades\DataTables::class,
]
.....

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

DMCA.com Protection Status