menu
How to Setup yajra data table in Laravel
How to Setup yajra data table in Laravel
Setup yajra data table in Laravel

1.Install Laravel

In First step, We need to get a fresh laravel version application using the below command. So Let’s open the terminal and run the command below.

composer create-project –prefer-dist laravel/laravel blog

2. Configuration .env file

In this step, we will set database credential in .env file

3. Run Migration

We need to do the migration of tables using below command:

php artisan migrate

This command will create tables in our database.

4. Install Yajra Datatable Package in Laravel

composer require yajra/laravel-datatables-oracle

After successfully Install Yajra Datatable Packages, open config/app.php file and add service provider and alias.

config/app.php

After set providers and aliases then publish vendor run by the following command.

php artisan vendor:publish

5. Add Fake Records

We need to add some records in the database. Use the below command for adding fake records in your database.

php artisan tinker

After running the php artisan tinker. Use the below command. This command will add 150 fake records in your database

6. Create Route, Controller & Blade View

Add Route

Now we will add routes in web.php file as like below.

Open routes/web.php file