Laravel DataTables UI Preset to setup most of the scripts and css required for a DataTables powered projects.
You can install the package via composer:
composer require yajra/laravel-datatables-ui
Once the package has been installed, you may install the frontend scaffolding using the ui Artisan command:
// Generate basic scaffolding...
php artisan ui dt
// Generate login / registration scaffolding...
php artisan ui dt --auth
If you have license and want to use Editor, you need to setup the following:
- Enable editor library on
bootstrap.js
require('datatables.net-editor-bs4');
- Use
laravel-datatables-assets
package instead ofbuttons.server-side.js
script onapp.js
.
//require('./vendor/buttons.server-side');
require('laravel-datatables-assets/js/dataTables.buttons');
- Add
postinstall
script on package,json
"scripts": {
"dev": "npm run development",
...,
"postinstall": "node ./node_modules/datatables.net-editor/install.js ./Editor.zip"
},
- Download your copy of Editor Library JS + CSS file and save as
Editor.zip
. - Move
Editor.zip
to your project base directory. - Run
npm install && npm run dev
to compile changes.
To use @dataTable
blade directive, you need to firt setup the following on your layout file.
- Include
app.css
on your layout. - Include
app.js
on your layout. - Add
@stack('scripts')
afterapp.js
script include.
resources/views/layouts/app.php
<!DOCTYPE html>
<html>
<head>
<title>Laravel</title>
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
</head>
<body>
@yield('content')
<script src="{{ mix('js/app.js') }}"></script>
@stack('scripts')
</body>
</html>
Create your dataTables class. See https://yajrabox.com/docs/laravel-datatables/master/buttons-starter for details.
On your view:
@extends('layouts.app')
@section('content')
@dataTable
@endsection
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email aqangeles@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.