Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Data Table will allow you to easily create Listing, Searching, Sorting and Download CSV.

License

Notifications You must be signed in to change notification settings

lakipatel/data-table

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Data Table

Laravel Data Table will allow you to easily create Listing, Searching, Sorting and Download CSV for Laravel.

Install

composer require lakipatel/data-table

Add bellow lines in config/app.php under providers

Maatwebsite\Excel\ExcelServiceProvider::class,
Lakipatel\DataTable\DataTableServiceProvider::class

run this command to publish php artisan vendor:publish

CLI - Create Data Table Object

run this commnad to generate data table php artisan data-table:create

Above command will create a file under app/DataTables/ directory.

Change your controller like

namespace App\Http\Controllers;

use App\DataTables\UserDataTable;

class UsersController
{

    public function index()
    {
        $dataTableHTML = UserDataTable::toHTML();
        return view('users.index', compact('dataTableHTML'));
    }

}

Add bellow line where you want to display data table under resources/views/users/index.blade.php.

{!! $dataTableHTML !!}

Add bellow lines in your layout file to include assets

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<script src="{{ asset('vendor/data-table/data-table.js') }}"></script>
@stack('scripts')

About

Data Table will allow you to easily create Listing, Searching, Sorting and Download CSV.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.