From 163a1b533c29d895196e7c3b8e4491f3dab2e7bb Mon Sep 17 00:00:00 2001 From: mark-git07 Date: Sun, 23 Oct 2022 18:51:03 +0800 Subject: [PATCH 01/47] initial revisions for a few document files v10.0 --- add-column.md | 4 ++-- buttons-config.md | 10 +++++----- buttons-console.md | 12 ++++++------ buttons-custom.md | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/add-column.md b/add-column.md index 92e82c0..d5b984c 100644 --- a/add-column.md +++ b/add-column.md @@ -1,8 +1,8 @@ # Add Column -You can add a custom column on your response by using `addColumn` api. +You can add a custom column to your response by using the `addColumn` api. -> {note} added columns are assumed to be computed columns and not part of the database. Thus, search/sort will be disabled on those columns. If you need them, use the `editColumn` api instead. +> {note} added columns are assumed to be computed columns and not part of the database. Thus, search/sort will be disabled for those columns. If you need them, use the `editColumn` api instead. ## Add Column with Blade Syntax diff --git a/buttons-config.md b/buttons-config.md index 5b4260d..817b62e 100644 --- a/buttons-config.md +++ b/buttons-config.md @@ -12,8 +12,8 @@ Namespace configuration is used by the datatables command generator. ``` ### DataTable Base Namespace/Directory -This is the base namespace/directory to be created when a new DataTable was called. -This directory is appended on default Laravel namespace. +This is the base namespace/directory to be created when a new DataTable is called. +This directory is appended to the default Laravel namespace. **Usage:** ```php artisan datatables:make User``` @@ -24,8 +24,8 @@ This directory is appended on default Laravel namespace. **Export filename:** ```users_(timestamp)``` ### Model Option -This is the base namespace/directory where your model's are located. -This directory is appended on default Laravel namespace. +This is the base namespace/directory where your models are located. +This directory is appended to the default Laravel namespace. **Usage:** ```php artisan datatables:make Post --model``` **Output:** ```App\DataTables\PostDataTable``` **With Model:** ```App\Post`` @@ -33,7 +33,7 @@ This directory is appended on default Laravel namespace. ## PDF Generator -Set the PDF generator to be used when converting your dataTable to pdf. +Set the PDF generator to be used when converting your dataTable to PDF. Available generators are: `excel`, `snappy` diff --git a/buttons-console.md b/buttons-console.md index 7e88422..0efc0fc 100644 --- a/buttons-console.md +++ b/buttons-console.md @@ -18,7 +18,7 @@ In this example, we will create a DataTable service class. php artisan datatables:make Posts ``` -This will create an `PostsDataTable` class on `app\DataTables` directory. +This will create a `PostsDataTable` class in the `app\DataTables` directory. ```php namespace App\DataTables; @@ -101,7 +101,7 @@ In this example, we will pass a `--model` option to set the model to be used by php artisan datatables:make Posts --model ``` -This will generate a `App\DataTables\PostsDataTable` class that uses `App\Post` as the base model for our query. +This will generate an `App\DataTables\PostsDataTable` class that uses `App\Post` as the base model for our query. The exported filename will also be set to `posts_(timestamp)`. ```php @@ -194,12 +194,12 @@ This will allow to use a non-standard namespace if front-end and back-end models ### Action Option -In this example, we will pass a `--action` option to set a custom path for the action column view. +In this example, we will use the `--action` option to set a custom path for the action column view. ``` php artisan datatables:make Posts --action="client.action" ``` -If not provided, a default path will be used. It will needs to be changed thereafter. +If no path is provided, a default path will be used. It will need to be changed thereafter. ### Columns Option @@ -208,13 +208,13 @@ In this example, we will pass a `--columns` option to set the columns to be used ``` php artisan datatables:make Posts --columns="id,title,author" ``` -If not provided, a default set of columns will be used. It will needs to be manually changed thereafter. +If not provided, a default set of columns will be used. It will need to be manually changed thereafter. ## Creating a DataTable Scope service class -DataTable scope is class that we can use to limit our database search results based on the defined query scopes. +DataTable scope is a class that we can use to limit our database search results based on the defined query scopes. ``` php artisan datatables:scope ActiveUser diff --git a/buttons-custom.md b/buttons-custom.md index 9330875..0f178ca 100644 --- a/buttons-custom.md +++ b/buttons-custom.md @@ -1,9 +1,9 @@ # Custom Actions -You can enable custom actions on your buttons, as follows: +You can enable custom actions on your buttons as follows: Update `UsersDataTable` class and overload the `actions` property. Here we are -disabling the `csv` and `pdf` action (so they cannot be fired by hijacking the +disabling the `csv` and `pdf` actions (so they cannot be fired by hijacking their request) and enabling a `myCustomAction`. From 689ab8688c3a72cedc49ed593b3a88ad1777b00d Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 26 Oct 2022 19:48:19 +0800 Subject: [PATCH 02/47] docs: use h2 & h3 --- quick-starter.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/quick-starter.md b/quick-starter.md index 85f03e7..8c7ddc3 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -1,26 +1,26 @@ -# DataTables Quick Starter +## DataTables Quick Starter -## Create a new Laravel project +### Create a new Laravel project ``` laravel new datatables cd datatables ``` -## Setup Laravel UI +### Setup Laravel UI ```shell composer require laravel/ui --dev php artisan ui bootstrap --auth ``` -## Install Laravel DataTables +### Install Laravel DataTables ```shell composer require yajra/laravel-datatables:^9.0 ``` -## Setup database and ENV configuration +### Setup database and ENV configuration Create a new database and update `.env` file and set the database credentials. @@ -37,7 +37,7 @@ DB_DATABASE=/absolute/path/to/database/database.sqlite php artisan migrate ``` -## Install Laravel DataTables Vite Assets +### Install Laravel DataTables Vite Assets ```shell npm i laravel-datatables-vite --save-dev @@ -49,7 +49,7 @@ This will install the following packages: 2. DataTables with Buttons and Select plugins for Bootstrap 5 3. Laravel DataTables custom scripts -## Register the package js and css +### Register the package js and css Edit `resources/js/app.js` and add the following: @@ -77,13 +77,13 @@ Edit `resources/sass/app.scss` and add the following: @import 'datatables.net-select-bs5/css/select.bootstrap5.css'; ``` -## Compile the assets +### Compile the assets ``` npm run dev ``` -## Create and update UsersDataTable +### Create and update UsersDataTable Create a new DataTable class: @@ -153,7 +153,7 @@ class UsersDataTable extends DataTable } ``` -## Create and update the users controller +### Create and update the users controller Create a new controller and add the following: @@ -175,7 +175,7 @@ class UsersController extends Controller } ``` -## Update the default app layout +### Update the default app layout Add `@stack('scripts')` before the body end tag of `resources/views/layouts/app.blade.php` @@ -190,7 +190,7 @@ Add `@stack('scripts')` before the body end tag of `resources/views/layouts/app. ``` -## Create users index file +### Create users index file Create new file: `resources/views/users/index.blade.php`. @@ -213,7 +213,7 @@ Create new file: `resources/views/users/index.blade.php`. @endpush ``` -## Register users route +### Register users route Update `routes/web.php`. @@ -223,7 +223,7 @@ use App\Http\Controllers\UsersController; Route::get('/users', [UsersController::class, 'index'])->name('users.index'); ``` -## Create dummy data using tinker +### Create dummy data using tinker ```php php artisan tinker @@ -232,7 +232,7 @@ Psy Shell v0.9.9 (PHP 7.2.22 — cli) by Justin Hileman >>> User::factory(100)->create() ``` -## Access Users DataTables +### Access Users DataTables http://datatables.test/users From 09578ccdf0ea96395366de3bc9021299eb4f31c9 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 26 Oct 2022 19:57:05 +0800 Subject: [PATCH 03/47] Revert "docs: use h2 & h3" This reverts commit 689ab8688c3a72cedc49ed593b3a88ad1777b00d. --- quick-starter.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/quick-starter.md b/quick-starter.md index 8c7ddc3..85f03e7 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -1,26 +1,26 @@ -## DataTables Quick Starter +# DataTables Quick Starter -### Create a new Laravel project +## Create a new Laravel project ``` laravel new datatables cd datatables ``` -### Setup Laravel UI +## Setup Laravel UI ```shell composer require laravel/ui --dev php artisan ui bootstrap --auth ``` -### Install Laravel DataTables +## Install Laravel DataTables ```shell composer require yajra/laravel-datatables:^9.0 ``` -### Setup database and ENV configuration +## Setup database and ENV configuration Create a new database and update `.env` file and set the database credentials. @@ -37,7 +37,7 @@ DB_DATABASE=/absolute/path/to/database/database.sqlite php artisan migrate ``` -### Install Laravel DataTables Vite Assets +## Install Laravel DataTables Vite Assets ```shell npm i laravel-datatables-vite --save-dev @@ -49,7 +49,7 @@ This will install the following packages: 2. DataTables with Buttons and Select plugins for Bootstrap 5 3. Laravel DataTables custom scripts -### Register the package js and css +## Register the package js and css Edit `resources/js/app.js` and add the following: @@ -77,13 +77,13 @@ Edit `resources/sass/app.scss` and add the following: @import 'datatables.net-select-bs5/css/select.bootstrap5.css'; ``` -### Compile the assets +## Compile the assets ``` npm run dev ``` -### Create and update UsersDataTable +## Create and update UsersDataTable Create a new DataTable class: @@ -153,7 +153,7 @@ class UsersDataTable extends DataTable } ``` -### Create and update the users controller +## Create and update the users controller Create a new controller and add the following: @@ -175,7 +175,7 @@ class UsersController extends Controller } ``` -### Update the default app layout +## Update the default app layout Add `@stack('scripts')` before the body end tag of `resources/views/layouts/app.blade.php` @@ -190,7 +190,7 @@ Add `@stack('scripts')` before the body end tag of `resources/views/layouts/app. ``` -### Create users index file +## Create users index file Create new file: `resources/views/users/index.blade.php`. @@ -213,7 +213,7 @@ Create new file: `resources/views/users/index.blade.php`. @endpush ``` -### Register users route +## Register users route Update `routes/web.php`. @@ -223,7 +223,7 @@ use App\Http\Controllers\UsersController; Route::get('/users', [UsersController::class, 'index'])->name('users.index'); ``` -### Create dummy data using tinker +## Create dummy data using tinker ```php php artisan tinker @@ -232,7 +232,7 @@ Psy Shell v0.9.9 (PHP 7.2.22 — cli) by Justin Hileman >>> User::factory(100)->create() ``` -### Access Users DataTables +## Access Users DataTables http://datatables.test/users From f4bc1d09df91b856374867fdbebdc238bbff2601 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 11:59:44 +0800 Subject: [PATCH 04/47] docs: remove some badge --- introduction.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/introduction.md b/introduction.md index fc30ba1..aaa9b08 100644 --- a/introduction.md +++ b/introduction.md @@ -20,13 +20,10 @@ Official documentation of DataTables is available at [datatables.net](https://da ## Laravel DataTables -[![Join the chat at https://gitter.im/yajra/laravel-datatables](https://badges.gitter.im/yajra/laravel-datatables.svg)](https://gitter.im/yajra/laravel-datatables?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![License](https://poser.pugx.org/yajra/laravel-datatables-oracle/license)](https://packagist.org/packages/yajra/laravel-datatables-oracle) -[![Laravel 4.2|5.x](https://img.shields.io/badge/Laravel-4.2|5.x-orange.svg)](http://laravel.com) [![Latest Stable Version](https://poser.pugx.org/yajra/laravel-datatables-oracle/v/stable)](https://packagist.org/packages/yajra/laravel-datatables-oracle) -[![Build Status](https://travis-ci.org/yajra/laravel-datatables.svg?branch=master)](https://travis-ci.org/yajra/laravel-datatables) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yajra/{{package}}/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yajra/{{package}}/?branch=master) + [![Total Downloads](https://poser.pugx.org/yajra/laravel-datatables-oracle/downloads)](https://packagist.org/packages/yajra/laravel-datatables-oracle) Laravel DataTables is a package that handles the [server-side](https://www.datatables.net/manual/server-side) works of [DataTables](http://datatables.net) using [Laravel](http://laravel.com). From 83b8c1f6fc88bb49afa0e355e0aeff7e131cfc99 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 12:48:14 +0800 Subject: [PATCH 05/47] Update buttons-installation.md --- buttons-installation.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/buttons-installation.md b/buttons-installation.md index 424966c..438fafd 100644 --- a/buttons-installation.md +++ b/buttons-installation.md @@ -1,12 +1,19 @@ -# Buttons Plugin Installation +# Buttons Plugin -Github: https://github.com/yajra/laravel-datatables-buttons +A Laravel DataTables plugin for handling server-side exporting of table as csv, excel, pdf, etc. + + +## Installation Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-buttons:^9.0` +```shell +composer require yajra/laravel-datatables-buttons:^9.0 +``` + ## Configuration + > This step is optional if you are using Laravel 5.5 Open the file ```config/app.php``` and then add following service provider. @@ -21,6 +28,6 @@ Open the file ```config/app.php``` and then add following service provider. After completing the step above, use the following command to publish configuration & assets: -``` +```shell php artisan vendor:publish --tag=datatables-buttons ``` From 044a11ac884dbd77b9cac04e3b1ab88cd06ce5e7 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 12:49:48 +0800 Subject: [PATCH 06/47] docs: 5.5+ --- buttons-installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buttons-installation.md b/buttons-installation.md index 438fafd..839f35b 100644 --- a/buttons-installation.md +++ b/buttons-installation.md @@ -14,7 +14,7 @@ composer require yajra/laravel-datatables-buttons:^9.0 ## Configuration -> This step is optional if you are using Laravel 5.5 +> This step is optional if you are using Laravel 5.5+ Open the file ```config/app.php``` and then add following service provider. From 98c518e28a89e6f25d472ab3bfd1f6a888061552 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 12:52:20 +0800 Subject: [PATCH 07/47] docs: remove link to old tutz --- documentation.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/documentation.md b/documentation.md index 226ef6a..02896f0 100644 --- a/documentation.md +++ b/documentation.md @@ -5,14 +5,13 @@ - [Security Issues](/docs/{{package}}/{{version}}/security) - ## Getting Started - - [Introduction](/docs/{{package}}/{{version}}/introduction) - - [Installation](/docs/{{package}}/{{version}}/installation) + - [Introduction](/docs/{{package}}/{{version}}/introduction) + - [Installation](/docs/{{package}}/{{version}}/installation) - [Demo Application](https://datatables.yajrabox.com/) - [Community Links](/docs/{{package}}/{{version}}/community-links) - ## Tutorials - - [Quick Starter](/docs/{{package}}/{{version}}/quick-starter) - - [Service Implementation](https://datatables.yajrabox.com/service) + - [Quick Starter](/docs/{{package}}/{{version}}/quick-starter) - ## Configuration - [General Settings](/docs/{{package}}/{{version}}/general-settings) From a5608217bcb86b74167d0554a42dd19f64bc8e7f Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 17:17:18 +0800 Subject: [PATCH 08/47] docs: bootcamp style quick starter --- quick-starter.md | 136 +++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/quick-starter.md b/quick-starter.md index 85f03e7..5922ebf 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -1,43 +1,41 @@ -# DataTables Quick Starter +# Quick Starter -## Create a new Laravel project + +## 01. Installing Laravel & DataTables -``` +### Quick Installation + +If you have already installed [Laravel Installer](https://laravel.com/docs#your-first-laravel-project) on your local machine, you may create a new project via laravel command: + +```shell laravel new datatables -cd datatables ``` -## Setup Laravel UI +After the project has been created, we will then install [Laravel UI](https://github.com/laravel/ui) and [Yajra DataTables](https://github.com/yajra/laravel-datatables) ```shell +cd datatables + composer require laravel/ui --dev php artisan ui bootstrap --auth -``` - -## Install Laravel DataTables -```shell composer require yajra/laravel-datatables:^9.0 ``` -## Setup database and ENV configuration - -Create a new database and update `.env` file and set the database credentials. +For simplicity, you may use SQLite to store your application's data. To instruct Laravel to use SQLite instead of MySQL, update your new application's `.env` file and remove all of the `DB_*` environment variables except for the `DB_CONNECTION` variable, which should be set to `sqlite`: ```shell touch database/database.sqlite ``` -```dotenv +```dotenv filename=.env DB_CONNECTION=sqlite -DB_DATABASE=/absolute/path/to/database/database.sqlite ``` -```shell -php artisan migrate -``` + +## 02. Install Laravel DataTables Vite -## Install Laravel DataTables Vite Assets +Next, we will install [Laravel DataTables Vite](https://github.com/yajra/laravel-datatables-vite) to simplify our frontend setup. ```shell npm i laravel-datatables-vite --save-dev @@ -45,22 +43,20 @@ npm i laravel-datatables-vite --save-dev This will install the following packages: -1. Bootstrap Icons -2. DataTables with Buttons and Select plugins for Bootstrap 5 -3. Laravel DataTables custom scripts - -## Register the package js and css +``` + - Bootstrap Icons + - DataTables with Buttons and Select plugins for Bootstrap 5 + - Laravel DataTables custom scripts +``` -Edit `resources/js/app.js` and add the following: +Once installed, we can now configure our scripts and css needed for our application. -```js +```js filename=resources/js/app.js import './bootstrap'; import 'laravel-datatables-vite'; ``` -Edit `resources/sass/app.scss` and add the following: - -```postcss +```postcss filename=resources/sass/app.scss // Fonts @import url('https://fonts.bunny.net/css?family=Nunito'); @@ -77,23 +73,24 @@ Edit `resources/sass/app.scss` and add the following: @import 'datatables.net-select-bs5/css/select.bootstrap5.css'; ``` -## Compile the assets +We just need to start the Vite development server to automatically recompile our JS, CSS and refresh the browser when we make changes to our Blade templates: -``` +```shell npm run dev ``` -## Create and update UsersDataTable + +## 03. Setup a Users DataTable -Create a new DataTable class: +Open a new terminal in your `datatables` project directory and run the following command: ```shell php artisan datatables:make Users ``` -Then, update the `getColumns()` with the users fields: +Next, we will configure our `UsersDataTable` and add the columns that we want to display. -```php +```php filename=app/DataTables/UsersDataTable.php namespace App\DataTables; use App\Models\User; @@ -135,7 +132,7 @@ class UsersDataTable extends DataTable ]); } - protected function getColumns(): array + public function getColumns(): array { return [ Column::make('id'), @@ -153,15 +150,14 @@ class UsersDataTable extends DataTable } ``` -## Create and update the users controller - -Create a new controller and add the following: + +## 04. Setup a Users Controller, View & Route ```shell php artisan make:controller UsersController ``` -```php +```php filename=app/Http/Controllers/UsersController.php namespace App\Http\Controllers; use App\DataTables\UsersDataTable; @@ -175,26 +171,7 @@ class UsersController extends Controller } ``` -## Update the default app layout - -Add `@stack('scripts')` before the body end tag of `resources/views/layouts/app.blade.php` - -``` -.... -
- @yield('content') -
- - @stack('scripts') - - -``` - -## Create users index file - -Create new file: `resources/views/users/index.blade.php`. - -```php +```blade filename=resources/views/users/index.blade.php @extends('layouts.app') @section('content') @@ -213,26 +190,49 @@ Create new file: `resources/views/users/index.blade.php`. @endpush ``` -## Register users route - -Update `routes/web.php`. - -```php +```php filename=routes/web.php use App\Http\Controllers\UsersController; Route::get('/users', [UsersController::class, 'index'])->name('users.index'); ``` -## Create dummy data using tinker + +## 05. Update the default app layout -```php +To be able to load our custom scripts, we need to add `@stack('scripts')` before the end of `body` tag in our `app.blade.php` layout. + +```blade filename=resources/views/layouts/app.blade.php +.... +
+ @yield('content') +
+ + @stack('scripts') + + +``` + + +## 06. Migrate and Seed Test Data + +```shell +php artisan migrate php artisan tinker +``` +```php Psy Shell v0.9.9 (PHP 7.2.22 — cli) by Justin Hileman >>> User::factory(100)->create() ``` -## Access Users DataTables +Our application should now be ready to run. + +```shell +php artisan serve +``` + +Once you have started the Artisan development server, your application will be accessible in your web browser at [http://localhost:8000]([http://localhost:8000). -http://datatables.test/users +We can now visit our [`/users`](http://localhost:8000/users) via route and see our users table. +Laravel DataTables Users From 29fab38c39990ada63b5fa655a3703857e26033d Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 17:50:27 +0800 Subject: [PATCH 09/47] fix: typo --- quick-starter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick-starter.md b/quick-starter.md index 5922ebf..1f8fb34 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -233,6 +233,6 @@ php artisan serve Once you have started the Artisan development server, your application will be accessible in your web browser at [http://localhost:8000]([http://localhost:8000). -We can now visit our [`/users`](http://localhost:8000/users) via route and see our users table. +We can now visit our [`/users`](http://localhost:8000/users) route and see our users table. Laravel DataTables Users From 0f51be95f03a917ad256851cc0144d7472e81f70 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 17:54:00 +0800 Subject: [PATCH 10/47] use image from site --- quick-starter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quick-starter.md b/quick-starter.md index 1f8fb34..e911865 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -233,6 +233,6 @@ php artisan serve Once you have started the Artisan development server, your application will be accessible in your web browser at [http://localhost:8000]([http://localhost:8000). -We can now visit our [`/users`](http://localhost:8000/users) route and see our users table. +We can now visit our [`/users`](http://localhost:8000/users) via route and see our users table. -Laravel DataTables Users +Laravel DataTables Users From 6f945e88d961a56c4caed50a0ced777499cfcf76 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 17:58:37 +0800 Subject: [PATCH 11/47] Update documentation.md --- documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation.md b/documentation.md index 02896f0..c1160d4 100644 --- a/documentation.md +++ b/documentation.md @@ -77,7 +77,7 @@ ### PLUGINS -- ## HTML Builder +- ## Html - [Installation](/docs/{{package}}/{{version}}/html-installation) - [Builder](/docs/{{package}}/{{version}}/html-builder) - [Table](/docs/{{package}}/{{version}}/html-builder-table) From 0a4795817c7a8a5320dcdc6f31d8ef429970f902 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 18:03:18 +0800 Subject: [PATCH 12/47] typo --- quick-starter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick-starter.md b/quick-starter.md index e911865..7e96d71 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -233,6 +233,6 @@ php artisan serve Once you have started the Artisan development server, your application will be accessible in your web browser at [http://localhost:8000]([http://localhost:8000). -We can now visit our [`/users`](http://localhost:8000/users) via route and see our users table. +We can now visit our [`/users`](http://localhost:8000/users) route and see our users table. Laravel DataTables Users From 9832eaa53b62c524d33abc090bf1b3ab054c4a8f Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 18:40:36 +0800 Subject: [PATCH 13/47] Update search-panes-starter.md --- search-panes-starter.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/search-panes-starter.md b/search-panes-starter.md index a9c96e9..9385858 100644 --- a/search-panes-starter.md +++ b/search-panes-starter.md @@ -5,11 +5,13 @@ allow the user to quickly filter the datatable after predefined filters. > {note} To use datatables you need to make sure that the npm packages `datatables.net-select-bs4` and `datatables.net-searchpanes-bs4` are installed and added to your `app.js`/`app.css` files. + ## Adding SearchPanes to the frontend To be able to see SearchPanes you need to either add them fixed in the dom (displayed at all time) or add a button which opens them as popup. + ### Adding SearchPanes fixed in the dom SearchPanes can be added to a table via the dom string, in it, they are marked with a `P` if you for example @@ -17,6 +19,7 @@ are using `Bfrtip` as dom you can use `PBfrtip` to display the SearchPanes at th to display them at the very bottom. Setting the dom String with the `\Yajra\DataTables\Html\Builder`: + ```php public function html() : \Yajra\DataTables\Html\Builder { @@ -34,6 +37,7 @@ public function html() : \Yajra\DataTables\Html\Builder } ``` + ### Adding SearchPanes with a button To add a button which opens the SearchPanes you need to make one extending `searchPanes`: @@ -58,6 +62,7 @@ public function html() : \Yajra\DataTables\Html\Builder } ``` + ## Adding SearchPanes to the backend The SearchPanes can be filled in the datatables declaration via the `searchPane()` method. The method takes the column From 3f40edc63960a55ce2764187afc3547e7ada1070 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 18:42:29 +0800 Subject: [PATCH 14/47] Update search-panes-starter.md --- search-panes-starter.md | 1 - 1 file changed, 1 deletion(-) diff --git a/search-panes-starter.md b/search-panes-starter.md index 9385858..55f09e3 100644 --- a/search-panes-starter.md +++ b/search-panes-starter.md @@ -5,7 +5,6 @@ allow the user to quickly filter the datatable after predefined filters. > {note} To use datatables you need to make sure that the npm packages `datatables.net-select-bs4` and `datatables.net-searchpanes-bs4` are installed and added to your `app.js`/`app.css` files. - ## Adding SearchPanes to the frontend To be able to see SearchPanes you need to either add them fixed in the dom (displayed at all time) or add a button which From 4a34b91b78b71f3839f73cc070c29569a4288557 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 18:44:40 +0800 Subject: [PATCH 15/47] remove demo app link --- documentation.md | 1 - 1 file changed, 1 deletion(-) diff --git a/documentation.md b/documentation.md index c1160d4..206ceba 100644 --- a/documentation.md +++ b/documentation.md @@ -7,7 +7,6 @@ - ## Getting Started - [Introduction](/docs/{{package}}/{{version}}/introduction) - [Installation](/docs/{{package}}/{{version}}/installation) - - [Demo Application](https://datatables.yajrabox.com/) - [Community Links](/docs/{{package}}/{{version}}/community-links) - ## Tutorials From 181c41d997f61651d9332753e14ff61455a2a18a Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 18:49:55 +0800 Subject: [PATCH 16/47] Update response-array.md --- response-array.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/response-array.md b/response-array.md index 59270ee..aa73ff1 100644 --- a/response-array.md +++ b/response-array.md @@ -1,6 +1,6 @@ # Array Response -Array response is the default response of DataTables. +The default response of the package is an array of objects. If you prefer to return an array response, use `make(false)`. ```php use DataTables; @@ -10,7 +10,7 @@ Route::get('user-data', function() { return DataTables::eloquent($model) ->addColumn('intro', 'Hi {{$name}}!') - ->make(); + ->make(false); }); ``` From d36787f2b5da1c7e498c239b4b3848c4405ab4e3 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 19:01:18 +0800 Subject: [PATCH 17/47] Update html-builder.md --- html-builder.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/html-builder.md b/html-builder.md index 7faf9c1..a39d6de 100644 --- a/html-builder.md +++ b/html-builder.md @@ -11,6 +11,7 @@ You can use the `Builder` class by using Dependency Injection. use Yajra\DataTables\Html\Builder; Route::get('users', function(Builder $builder) { + // }); ``` @@ -37,9 +38,10 @@ Route::get('users', function(DataTables $dataTable) { ## Html Builder Example -```php +```php filename=routes/web.php use DataTables; use Yajra\DataTables\Html\Builder; +use Yajra\DataTables\Html\Column; Route::get('users', function(Builder $builder) { if (request()->ajax()) { @@ -47,27 +49,26 @@ Route::get('users', function(Builder $builder) { } $html = $builder->columns([ - ['data' => 'id', 'name' => 'id', 'title' => 'Id'], - ['data' => 'name', 'name' => 'name', 'title' => 'Name'], - ['data' => 'email', 'name' => 'email', 'title' => 'Email'], - ['data' => 'created_at', 'name' => 'created_at', 'title' => 'Created At'], - ['data' => 'updated_at', 'name' => 'updated_at', 'title' => 'Updated At'], + Column::make('id), + Column::make('name), + Column::make('email), + Column::make('created_at), + Column::make('updated_at), ]); return view('users.index', compact('html')); }); ``` -On your `resources/views/users/index.blade.php`. -```php +```php filename=resources/views/users/index.blade.php @extends('app') @section('contents') - {!! $html->table() !!} + {{ $html->table() }} @endsection @push('scripts') - {!! $html->scripts() !!} + {{ $html->scripts() }} @endpush ``` From 01be62e252bbafe361c274004ecb7179e2540f63 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 27 Oct 2022 19:05:01 +0800 Subject: [PATCH 18/47] Update html-builder.md --- html-builder.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/html-builder.md b/html-builder.md index a39d6de..4339798 100644 --- a/html-builder.md +++ b/html-builder.md @@ -39,24 +39,25 @@ Route::get('users', function(DataTables $dataTable) { ## Html Builder Example ```php filename=routes/web.php -use DataTables; +use Yajra\DataTables\Facades\DataTables; use Yajra\DataTables\Html\Builder; use Yajra\DataTables\Html\Column; +use App\Models\User; Route::get('users', function(Builder $builder) { - if (request()->ajax()) { + if (request()->ajax()) { return DataTables::of(User::query())->toJson(); } - $html = $builder->columns([ - Column::make('id), - Column::make('name), - Column::make('email), - Column::make('created_at), - Column::make('updated_at), - ]); + $html = $builder->columns([ + Column::make('id'), + Column::make('name'), + Column::make('email'), + Column::make('created_at'), + Column::make('updated_at'), + ]); - return view('users.index', compact('html')); + return view('users.index', compact('html')); }); ``` From b5b423ab18fa580fa3526656a7b8045609d36cf9 Mon Sep 17 00:00:00 2001 From: Emmanuel Joseph Beron Date: Thu, 27 Oct 2022 23:48:34 +0800 Subject: [PATCH 19/47] Fix typo --- engine-eloquent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine-eloquent.md b/engine-eloquent.md index e2874c9..f68e4d0 100644 --- a/engine-eloquent.md +++ b/engine-eloquent.md @@ -1,7 +1,7 @@ # Eloquent Data Source You may use Laravel's Eloquent Model as data source for your dataTables. -You can look at `Yajra\DataTables\EloquentDataTable` class which handles the conversion of your Eloquent Model into a readbale DataTable API response. +You can look at `Yajra\DataTables\EloquentDataTable` class which handles the conversion of your Eloquent Model into a readable DataTable API response. ## Eloquent via Factory From f21ba2e56950cc90123e0938b994fcfaec0afe44 Mon Sep 17 00:00:00 2001 From: Emmanuel Joseph Beron Date: Thu, 27 Oct 2022 23:49:07 +0800 Subject: [PATCH 20/47] Fix typo --- engine-collection.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine-collection.md b/engine-collection.md index 3b8bed0..418ccc4 100644 --- a/engine-collection.md +++ b/engine-collection.md @@ -1,7 +1,7 @@ # Collection Data Source You may use Laravel's Collection as data source for your dataTables. -You can look at `Yajra\DataTables\CollectionDataTable` class which handles the conversion of your Collection into a readbale DataTable API response. +You can look at `Yajra\DataTables\CollectionDataTable` class which handles the conversion of your Collection into a readable DataTable API response. ## Collection via Factory From e024fbfb8e4c2ba624f3788977141facc2e43faa Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 3 Nov 2022 13:06:08 +0800 Subject: [PATCH 21/47] Update search-panes-starter.md --- search-panes-starter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/search-panes-starter.md b/search-panes-starter.md index 55f09e3..969e947 100644 --- a/search-panes-starter.md +++ b/search-panes-starter.md @@ -1,4 +1,4 @@ -# Add SearchPane +# SearchPanes Extension [SearchPanes](https://datatables.net/extensions/searchpanes/) ([example](https://datatables.net/extensions/searchpanes/examples/initialisation/simple.html)) allow the user to quickly filter the datatable after predefined filters. From a542888d5b8c4382df2101cf53fc660588e75927 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Thu, 3 Nov 2022 13:06:59 +0800 Subject: [PATCH 22/47] Update documentation.md --- documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation.md b/documentation.md index 206ceba..14788f5 100644 --- a/documentation.md +++ b/documentation.md @@ -61,7 +61,7 @@ - [Order By Nulls Last](/docs/{{package}}/{{version}}/order-by-nulls-last) - ## SearchPanes - - [Add SearchPanes](/docs/{{package}}/{{version}}/search-panes-starter) + - [SearchPanes Extension](/docs/{{package}}/{{version}}/search-panes-starter) - [Hide Columns in SearchPanes](/docs/{{package}}/{{version}}/search-panes-hide-columns) - [Further options](/docs/{{package}}/{{version}}/search-panes-options) From 178e1c04c762cb30e2bf4bff3c11c49f73bdc3ce Mon Sep 17 00:00:00 2001 From: Arne Perschke Date: Sat, 14 Jan 2023 13:26:52 +0100 Subject: [PATCH 23/47] Tweaked SearchPanes chapter titles --- search-panes-hide-columns.md | 2 +- search-panes-starter.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/search-panes-hide-columns.md b/search-panes-hide-columns.md index 3064861..9d51f67 100644 --- a/search-panes-hide-columns.md +++ b/search-panes-hide-columns.md @@ -1,4 +1,4 @@ -# Hide Columns in SearchPanes +# Exclude Columns Some columns you might not want in your SearchPanes, to hide them you can add `->searchPanes(false)` in your column definition: diff --git a/search-panes-starter.md b/search-panes-starter.md index 969e947..c363b22 100644 --- a/search-panes-starter.md +++ b/search-panes-starter.md @@ -1,4 +1,4 @@ -# SearchPanes Extension +# Getting Started [SearchPanes](https://datatables.net/extensions/searchpanes/) ([example](https://datatables.net/extensions/searchpanes/examples/initialisation/simple.html)) allow the user to quickly filter the datatable after predefined filters. From dfbf5456b01bddd092cabbdf922722e9159aa702 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Mon, 20 Feb 2023 15:32:22 +0800 Subject: [PATCH 24/47] Update installation.md --- installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation.md b/installation.md index 2db07f1..95e7af2 100644 --- a/installation.md +++ b/installation.md @@ -28,7 +28,7 @@ composer require yajra/laravel-datatables-oracle:"^10.0" If you are using most of the DataTables plugins like Buttons & Html, you can alternatively use the all-in-one installer package. ```bash -composer require yajra/laravel-datatables:^9.0 +composer require yajra/laravel-datatables:^10.0 ``` From 20aa69eb46ae4cb750b81a878e62f7bb9da78f2e Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Mon, 20 Feb 2023 20:15:28 +0800 Subject: [PATCH 25/47] docs: remove package version --- quick-starter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick-starter.md b/quick-starter.md index 7e96d71..fe09e60 100644 --- a/quick-starter.md +++ b/quick-starter.md @@ -19,7 +19,7 @@ cd datatables composer require laravel/ui --dev php artisan ui bootstrap --auth -composer require yajra/laravel-datatables:^9.0 +composer require yajra/laravel-datatables ``` For simplicity, you may use SQLite to store your application's data. To instruct Laravel to use SQLite instead of MySQL, update your new application's `.env` file and remove all of the `DB_*` environment variables except for the `DB_CONNECTION` variable, which should be set to `sqlite`: From 79bda837512eeca782b898572cd911f4ea472324 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Mon, 20 Feb 2023 23:47:09 +0800 Subject: [PATCH 26/47] docs: laravel 10 + vitejs setup --- editor-tutorial.md | 173 +++++++++++++++++++++++++++++---------------- 1 file changed, 113 insertions(+), 60 deletions(-) diff --git a/editor-tutorial.md b/editor-tutorial.md index cf453b2..f12d42b 100644 --- a/editor-tutorial.md +++ b/editor-tutorial.md @@ -5,11 +5,13 @@ See [DataTables Editor](https://editor.datatables.net/purchase/index) for detail ## Pre-requisites -This tutorial requires https://yajrabox.com/docs/laravel-datatables/master/quick-starter. +This tutorial requires https://yajrabox.com/docs/laravel-datatables/10.0/quick-starter. ## Install DataTables Editor assets. - yarn add datatables.net-editor datatables.net-editor-bs4 datatables.net-select-bs4 +```sh +npm i datatables.net-editor datatables.net-editor-bs5 +``` ## Editor License @@ -17,107 +19,158 @@ Copy and rename your `Editor.XX.zip` to `Editor.zip` and move it to project fold ## Register postinstall script to package.json +```json "scripts": { - "postinstall": "node ./node_modules/datatables.net-editor/install.js ./Editor.zip", - "dev": "npm run development", - ..... + "dev": "vite", + "build": "vite build", + "postinstall": "node node_modules/datatables.net-editor/install.js ./Editor.zip" }, +``` -## Register editor script on `resources/js/bootstrap.js` - - try { - window.Popper = require('popper.js').default; - window.$ = window.jQuery = require('jquery'); +## Register editor script on `resources/js/app.js` - require('bootstrap'); - require('datatables.net-bs4'); - require('datatables.net-buttons-bs4'); - require('datatables.net-select-bs4'); - require('datatables.net-editor-bs4'); - } catch (e) {} +```js +import './bootstrap'; +import 'laravel-datatables-vite'; +import "datatables.net-editor"; +import Editor from "datatables.net-editor-bs5"; +Editor(window, $); +``` ## Add editor styles on `resources/sass/app.scss`. - @import "~datatables.net-select-bs4/css/select.bootstrap4.css"; - @import "~datatables.net-editor-bs4/css/editor.bootstrap4.css"; - -## Recompile assets. +```css +// Fonts +@import url('https://fonts.bunny.net/css?family=Nunito'); - yarn - yarn watch / dev / prod +// Variables +@import 'variables'; +// Bootstrap +@import 'bootstrap/scss/bootstrap'; -## Update UsersDataTable and register the Editor buttons. - -> Note: CREATE button is in conflict with `buttons.server-side.js`. You need to remove the create button or rename it to something else like `add` button. - - DataTable.ext.buttons.add = { - className: 'buttons-add', +// DataTables +@import 'bootstrap-icons/font/bootstrap-icons.css'; +@import "datatables.net-bs5/css/dataTables.bootstrap5.css"; +@import "datatables.net-buttons-bs5/css/buttons.bootstrap5.css"; +@import "datatables.net-editor-bs5/css/editor.bootstrap5.css"; +@import 'datatables.net-select-bs5/css/select.bootstrap5.css'; +``` - text: function (dt) { - return ' ' + dt.i18n('buttons.add', 'Create'); - }, +## Recompile assets. - action: function (e, dt, button, config) { - window.location = window.location.href.replace(/\/+$/, "") + '/create'; - } - }; +```sh +npm run dev +``` ### UsersDataTable.php Create a new editor instance and add some fields for name and email. ```php +namespace App\DataTables; + +use App\Models\User; +use Illuminate\Database\Eloquent\Builder as QueryBuilder; +use Yajra\DataTables\EloquentDataTable; +use Yajra\DataTables\Html\Builder as HtmlBuilder; +use Yajra\DataTables\Html\Button; +use Yajra\DataTables\Html\Column; use Yajra\DataTables\Html\Editor\Editor; use Yajra\DataTables\Html\Editor\Fields; +use Yajra\DataTables\Services\DataTable; -... +class UsersDataTable extends DataTable +{ /** * Build DataTable class. * - * @param mixed $query Results from query() method. - * @return \Yajra\DataTables\DataTableAbstract + * @param QueryBuilder $query Results from query() method. + * @return \Yajra\DataTables\EloquentDataTable + */ + public function dataTable(QueryBuilder $query): EloquentDataTable + { + return (new EloquentDataTable($query)) + ->addColumn('action', 'users.action') + ->setRowId('id'); + } + + /** + * Get query source of dataTable. + * + * @param \App\Models\User $model + * @return \Illuminate\Database\Eloquent\Builder */ - public function dataTable($query) + public function query(User $model): QueryBuilder { - return datatables() - ->eloquent($query) - ->setRowId('id') // Set the RowID - ... + return $model->newQuery(); } - public function html() + /** + * Optional method if you want to use html builder. + * + * @return \Yajra\DataTables\Html\Builder + */ + public function html(): HtmlBuilder { return $this->builder() ->setTableId('users-table') ->columns($this->getColumns()) ->minifiedAjax() - ->dom('Bfrtip') ->orderBy(1) - ->buttons( + ->selectStyleSingle() + ->editors([ + Editor::make() + ->fields([ + Fields\Text::make('name'), + Fields\Text::make('email'), + ]), + ]) + ->buttons([ Button::make('create')->editor('editor'), Button::make('edit')->editor('editor'), Button::make('remove')->editor('editor'), - Button::make('export'), + Button::make('excel'), + Button::make('csv'), + Button::make('pdf'), Button::make('print'), Button::make('reset'), - Button::make('reload') - ) - ->editor( - Editor::make() - ->fields([ - Fields\Text::make('name'), - Fields\Text::make('email'), - Fields\Password::make('password'), - ]) - ); + Button::make('reload'), + ]); + } + + /** + * Get the dataTable columns definition. + * + * @return array + */ + public function getColumns(): array + { + return [ + Column::make('id'), + Column::make('name'), + Column::make('email'), + Column::make('created_at'), + Column::make('updated_at'), + ]; + } + + /** + * Get filename for export. + * + * @return string + */ + protected function filename(): string + { + return 'Users_'.date('YmdHis'); } +} ``` ## Create Editor Class to handle CRUD actions. -``` +```sh php artisan datatables:editor Users ``` @@ -125,13 +178,13 @@ php artisan datatables:editor Users Edit `routes/web.php` and register the store user route. -``` +```php Route::post('/users', 'UsersController@store')->name('users.store'); ``` ## Update users controller -``` +```php namespace App\Http\Controllers; use Illuminate\Http\Request; From 94bd5300d3d977b0ca885abd98197c14bebdc0dc Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Mon, 20 Feb 2023 23:55:23 +0800 Subject: [PATCH 27/47] fix: route --- editor-tutorial.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor-tutorial.md b/editor-tutorial.md index f12d42b..fdcc56b 100644 --- a/editor-tutorial.md +++ b/editor-tutorial.md @@ -179,7 +179,8 @@ php artisan datatables:editor Users Edit `routes/web.php` and register the store user route. ```php -Route::post('/users', 'UsersController@store')->name('users.store'); +Route::get('/users', [App\Http\Controllers\UsersController::class, 'index'])->name('users.index'); +Route::post('/users', [App\Http\Controllers\UsersController::class, 'store'])->name('users.store'); ``` ## Update users controller From bfed2fdbdbf920ef0906a9201007fb2b61f3d46b Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 21 Feb 2023 00:23:30 +0800 Subject: [PATCH 28/47] docs: add postinstall first --- editor-tutorial.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/editor-tutorial.md b/editor-tutorial.md index fdcc56b..94d7aad 100644 --- a/editor-tutorial.md +++ b/editor-tutorial.md @@ -7,12 +7,6 @@ See [DataTables Editor](https://editor.datatables.net/purchase/index) for detail This tutorial requires https://yajrabox.com/docs/laravel-datatables/10.0/quick-starter. -## Install DataTables Editor assets. - -```sh -npm i datatables.net-editor datatables.net-editor-bs5 -``` - ## Editor License Copy and rename your `Editor.XX.zip` to `Editor.zip` and move it to project folder. @@ -27,6 +21,12 @@ Copy and rename your `Editor.XX.zip` to `Editor.zip` and move it to project fold }, ``` +## Install DataTables Editor assets. + +```sh +npm i datatables.net-editor datatables.net-editor-bs5 +``` + ## Register editor script on `resources/js/app.js` ```js From 944538f984a439f5f2b503ddd41231c3770c84be Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 21 Feb 2023 00:25:08 +0800 Subject: [PATCH 29/47] docs: shorter title --- editor-tutorial.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/editor-tutorial.md b/editor-tutorial.md index 94d7aad..caff59b 100644 --- a/editor-tutorial.md +++ b/editor-tutorial.md @@ -1,4 +1,4 @@ -# Creating a Laravel Full CRUD with DataTables Editor. +# Laravel 10 CRUD with DataTables Editor. Before we begin, please be reminded that the Editor library that we are going to use here requires a paid license. See [DataTables Editor](https://editor.datatables.net/purchase/index) for details. @@ -91,9 +91,7 @@ class UsersDataTable extends DataTable */ public function dataTable(QueryBuilder $query): EloquentDataTable { - return (new EloquentDataTable($query)) - ->addColumn('action', 'users.action') - ->setRowId('id'); + return (new EloquentDataTable($query))->setRowId('id'); } /** From a65a0b63fb4c2bab34a13ac3a3024eed6e20d6ce Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 21 Feb 2023 12:29:00 +0800 Subject: [PATCH 30/47] docs: laravel 9 & 10 install docs --- installation.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/installation.md b/installation.md index 95e7af2..83c15e8 100644 --- a/installation.md +++ b/installation.md @@ -11,7 +11,7 @@ ### Requirements -- [Laravel 9+](https://github.com/laravel/framework) +- [Laravel 9|10](https://github.com/laravel/framework) - [jQuery DataTables v1.10.x](http://datatables.net/) @@ -21,6 +21,14 @@ Laravel DataTables can be installed with [Composer](http://getcomposer.org/doc/0 Run the following command in your project to get the latest version of the package: +#### Laravel 9 + +```bash +composer require yajra/laravel-datatables-oracle:"^9.0" +``` + +#### Laravel 10 + ```bash composer require yajra/laravel-datatables-oracle:"^10.0" ``` From 39150e363c354df30161c214661e09473592380d Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 21 Feb 2023 12:30:18 +0800 Subject: [PATCH 31/47] docs: fix installer --- installation.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/installation.md b/installation.md index 83c15e8..e24f5c0 100644 --- a/installation.md +++ b/installation.md @@ -21,19 +21,19 @@ Laravel DataTables can be installed with [Composer](http://getcomposer.org/doc/0 Run the following command in your project to get the latest version of the package: -#### Laravel 9 - ```bash -composer require yajra/laravel-datatables-oracle:"^9.0" +composer require yajra/laravel-datatables-oracle:"^10.0" ``` -#### Laravel 10 +If you are using most of the DataTables plugins like Buttons & Html, you can alternatively use the all-in-one installer package. + +#### Laravel 9 ```bash -composer require yajra/laravel-datatables-oracle:"^10.0" +composer require yajra/laravel-datatables:"^9.0" ``` -If you are using most of the DataTables plugins like Buttons & Html, you can alternatively use the all-in-one installer package. +#### Laravel 10 ```bash composer require yajra/laravel-datatables:^10.0 From 42b1e616e47ec8008d0963412462c58ca893920e Mon Sep 17 00:00:00 2001 From: nikunjkothiya <76523698+nikunjkothiya@users.noreply.github.com> Date: Fri, 12 May 2023 12:07:13 +0530 Subject: [PATCH 32/47] Update row-options.md Some tag information updated as per division. --- row-options.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/row-options.md b/row-options.md index 11c975e..50b0a5d 100644 --- a/row-options.md +++ b/row-options.md @@ -49,7 +49,7 @@ Setting row class via `blade` string. ## Row Data -Setting row class via `closure`. +Setting row data via `closure`. ```php ->setRowData([ @@ -62,7 +62,7 @@ Setting row class via `closure`. ]) ``` -Setting row class via `blade` string. +Setting row data via `blade` string. ```php ->setRowData([ @@ -74,7 +74,7 @@ Setting row class via `blade` string. ## Row Attributes -Setting row class via `closure`. +Setting row attribute via `closure`. ```php ->setRowAttr([ @@ -84,10 +84,10 @@ Setting row class via `closure`. ]) ``` -Setting row class via `blade` string. +Setting row attribute via `blade` string. ```php ->setRowAttr([ 'color' => '{{$color}}', ]) -``` \ No newline at end of file +``` From 8843dac44cdf3a83599a36829438b813498307fe Mon Sep 17 00:00:00 2001 From: Juan Carlos <16903487+carlosJCVC@users.noreply.github.com> Date: Tue, 23 Apr 2024 19:38:37 -0400 Subject: [PATCH 33/47] Update installation.md --- installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation.md b/installation.md index e24f5c0..eb5a0b5 100644 --- a/installation.md +++ b/installation.md @@ -43,7 +43,7 @@ composer require yajra/laravel-datatables:^10.0 ### Configuration > This step is optional if you are using Laravel 5.5+ -Open the file ```config/app.php``` and then add following service provider. +Open the file ```config/app.php``` or ```bootstrap/providers.php``` for Laravel 11 then add following service provider. ```php 'providers' => [ From 88f915904de44c11d04e3649f41c23bc3a38aeb2 Mon Sep 17 00:00:00 2001 From: Murtaja Ahmed Noyeem <42427285+Muurtaja@users.noreply.github.com> Date: Sun, 26 May 2024 15:23:19 +0600 Subject: [PATCH 34/47] fix: Ensure $actions property is explicitly typed as array in UserDataTable This commit fixes a type error in the UserDataTable class by explicitly typing the $actions property as an array. This change aligns with the expected type in the Yajra\DataTables\Services\DataTable class, preventing runtime errors and ensuring consistent data handling. - Updated the $actions property declaration from `protected $actions = ['print', 'excel', 'myCustomAction'];` to `protected array $actions = ['print', 'excel', 'myCustomAction'];`. - This change leverages PHP's property type declaration feature to enforce that $actions is always an array. - The modification enhances code robustness and readability, ensuring type safety and preventing potential issues related to incorrect data types. By making this update, the UserDataTable class now correctly adheres to the expected data structure, improving overall stability and maintainability. --- buttons-custom.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buttons-custom.md b/buttons-custom.md index 0f178ca..089a318 100644 --- a/buttons-custom.md +++ b/buttons-custom.md @@ -15,7 +15,7 @@ use Yajra\DataTables\Services\DataTable; class UsersDataTable extends DataTable { - protected $actions = ['print', 'excel', 'myCustomAction']; + protected array $actions = ['print', 'excel', 'myCustomAction']; public function html() { From a1dac6fe2e1e3742fc432dc6704d213df21031cd Mon Sep 17 00:00:00 2001 From: Milad Abdi Date: Sun, 16 Jun 2024 08:53:06 +0330 Subject: [PATCH 35/47] Refactor 'fastExcel' and 'fastExcelCallback' properties and method return type --- buttons-fast-excel.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/buttons-fast-excel.md b/buttons-fast-excel.md index fa04177..6e09a2b 100644 --- a/buttons-fast-excel.md +++ b/buttons-fast-excel.md @@ -9,14 +9,14 @@ FastExcel integration uses cursor behind the scene thus eager loaded columns wil ## Usage 1. Install `fast-excel` using `composer require rap2hpoutre/fast-excel`. -2. Create a dataTable class `php artisan datatables:make Users` +2. Create a dataTable class `php artisan datatables:make Users`. 3. Adjust `UsersDataTable` as needed. 4. Set property `$fastExcel = true`. ```php class UsersDataTable extends DataTable { - protected $fastExcel = true; + protected bool $fastExcel = true; ... } @@ -33,7 +33,7 @@ class UsersDataTable extends DataTable class UsersDataTable extends DataTable { protected $fastExcel = true; - protected $fastExcelCallback = false; + protected bool $fastExcelCallback = false; ``` @@ -46,9 +46,9 @@ Just override the `fastExcelCallback` method: ```php class UsersDataTable extends DataTable { - protected $fastExcel = true; + protected bool $fastExcel = true; - public function fastExcelCallback() + public function fastExcelCallback() \Closure { return function ($row) { return [ @@ -59,4 +59,4 @@ class UsersDataTable extends DataTable } ... -``` \ No newline at end of file +``` From a7880363e786d867918a7d3e80c5abca7f9a147b Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 18 Jun 2024 09:13:51 +0800 Subject: [PATCH 36/47] docs: Update buttons-fast-excel.md --- buttons-fast-excel.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buttons-fast-excel.md b/buttons-fast-excel.md index 6e09a2b..4d0819e 100644 --- a/buttons-fast-excel.md +++ b/buttons-fast-excel.md @@ -32,12 +32,12 @@ class UsersDataTable extends DataTable ```php class UsersDataTable extends DataTable { - protected $fastExcel = true; + protected bool $fastExcel = true; protected bool $fastExcelCallback = false; ``` -2. Exported file will now be based on how your query was structured. No header formatting and all selected columns in sql will be included in the output. +2. The exported file will now be based on your query's structure. No header formatting and all selected columns in sql will be included in the output. ## Using custom callback From fcdb88be30db419b7b15414021ab19bc2593ecc1 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 18 Jun 2024 13:14:20 +0800 Subject: [PATCH 37/47] docs: bump version --- buttons-installation.md | 2 +- fractal-installation.md | 2 +- html-installation.md | 2 +- installation.md | 14 +++----------- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/buttons-installation.md b/buttons-installation.md index 839f35b..45129b3 100644 --- a/buttons-installation.md +++ b/buttons-installation.md @@ -8,7 +8,7 @@ A Laravel DataTables plugin for handling server-side exporting of table as csv, Run the following command in your project to get the latest version of the plugin: ```shell -composer require yajra/laravel-datatables-buttons:^9.0 +composer require yajra/laravel-datatables-buttons:^11.0 ``` diff --git a/fractal-installation.md b/fractal-installation.md index e210f6b..6b53643 100644 --- a/fractal-installation.md +++ b/fractal-installation.md @@ -4,7 +4,7 @@ Github: https://github.com/yajra/laravel-datatables-fractal Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-fractal:^9.0` +`composer require yajra/laravel-datatables-fractal:^11.0` ## Configuration > This step is optional if you are using Laravel 5.5 diff --git a/html-installation.md b/html-installation.md index 507ce61..45a3f70 100644 --- a/html-installation.md +++ b/html-installation.md @@ -6,7 +6,7 @@ Github: https://github.com/yajra/laravel-datatables-html Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-html:^9.0` +`composer require yajra/laravel-datatables-html:^11.0` ## Configuration diff --git a/installation.md b/installation.md index eb5a0b5..dd7a8dd 100644 --- a/installation.md +++ b/installation.md @@ -11,7 +11,7 @@ ### Requirements -- [Laravel 9|10](https://github.com/laravel/framework) +- [Laravel 11](https://github.com/laravel/framework) - [jQuery DataTables v1.10.x](http://datatables.net/) @@ -22,21 +22,13 @@ Laravel DataTables can be installed with [Composer](http://getcomposer.org/doc/0 Run the following command in your project to get the latest version of the package: ```bash -composer require yajra/laravel-datatables-oracle:"^10.0" +composer require yajra/laravel-datatables-oracle:"^11.0" ``` If you are using most of the DataTables plugins like Buttons & Html, you can alternatively use the all-in-one installer package. -#### Laravel 9 - -```bash -composer require yajra/laravel-datatables:"^9.0" -``` - -#### Laravel 10 - ```bash -composer require yajra/laravel-datatables:^10.0 +composer require yajra/laravel-datatables:^11.0 ``` From 6c8de02d3e8ca55d1340ff7980ba646cd17ddfdd Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Tue, 18 Jun 2024 13:19:06 +0800 Subject: [PATCH 38/47] docs: editor version --- editor-installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor-installation.md b/editor-installation.md index c4c95b6..8418b18 100644 --- a/editor-installation.md +++ b/editor-installation.md @@ -11,14 +11,14 @@ A [premium license](https://editor.datatables.net/purchase/index) is required to Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-editor:^1.0` +`composer require yajra/laravel-datatables-editor:^11.0` ## Configuration > This step is optional if you are using Laravel 5.5 -Open the file ```config/app.php``` and then add following service provider. +Open the file ```config/app.php``` and then add the following service provider. ```php 'providers' => [ From 48e1ed74200b7b8a756af5ef5d7d29f005e2eeaf Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 16 Oct 2024 09:08:55 +0800 Subject: [PATCH 39/47] docs: use DataTables v2 --- installation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installation.md b/installation.md index dd7a8dd..bd054b2 100644 --- a/installation.md +++ b/installation.md @@ -12,7 +12,7 @@ ### Requirements - [Laravel 11](https://github.com/laravel/framework) -- [jQuery DataTables v1.10.x](http://datatables.net/) +- [DataTables v2.x](http://datatables.net/) ### Installing Laravel DataTables @@ -25,7 +25,7 @@ Run the following command in your project to get the latest version of the packa composer require yajra/laravel-datatables-oracle:"^11.0" ``` -If you are using most of the DataTables plugins like Buttons & Html, you can alternatively use the all-in-one installer package. +If you use most of the DataTables plugins like Buttons & HTML, you can use the all-in-one installer package. ```bash composer require yajra/laravel-datatables:^11.0 @@ -35,7 +35,7 @@ composer require yajra/laravel-datatables:^11.0 ### Configuration > This step is optional if you are using Laravel 5.5+ -Open the file ```config/app.php``` or ```bootstrap/providers.php``` for Laravel 11 then add following service provider. +Open the file ```config/app.php``` or ```bootstrap/providers.php``` for Laravel 11 then add the following service provider. ```php 'providers' => [ From fad9106a4b19dd710aad701be0f764dced8f9da2 Mon Sep 17 00:00:00 2001 From: Khaled Huthaily Date: Mon, 11 Nov 2024 13:39:59 -0700 Subject: [PATCH 40/47] use `query()` instead of deprecated `queryBuilder()` Starting from v10.x, `queryBuilder()` is deprecated, and `query()` should be used instead. However, the examples still use `queryBuilder()`. --- engine-query.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine-query.md b/engine-query.md index e800e53..700e6e9 100644 --- a/engine-query.md +++ b/engine-query.md @@ -27,7 +27,7 @@ use DataTables; Route::get('user-data', function() { $query = DB::table('users'); - return DataTables::queryBuilder($query)->toJson(); + return DataTables::query($query)->toJson(); }); ``` @@ -41,7 +41,7 @@ use Yajra\DataTables\DataTables; Route::get('user-data', function(DataTables $dataTables) { $query = DB::table('users'); - return $dataTables->queryBuilder($query)->toJson(); + return $dataTables->query($query)->toJson(); }); ``` @@ -53,7 +53,7 @@ use DB; Route::get('user-data', function() { $query = DB::table('users'); - return app('datatables')->queryBuilder($query)->toJson(); + return app('datatables')->query($query)->toJson(); }); ``` From b15808a73dea670ae61fec97004c3f5f61a0da42 Mon Sep 17 00:00:00 2001 From: Diogo Cerqueira <56158927+diogorcerqueira@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:34:18 +0000 Subject: [PATCH 41/47] Update installation.md --- installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation.md b/installation.md index bd054b2..7979009 100644 --- a/installation.md +++ b/installation.md @@ -28,7 +28,7 @@ composer require yajra/laravel-datatables-oracle:"^11.0" If you use most of the DataTables plugins like Buttons & HTML, you can use the all-in-one installer package. ```bash -composer require yajra/laravel-datatables:^11.0 +composer require yajra/laravel-datatables:"^11.0" ``` From 452a3690beaedf2e0fe83d4e81cee4d56831bacf Mon Sep 17 00:00:00 2001 From: haroon-mahmood-4276 Date: Thu, 27 Feb 2025 11:23:38 +0500 Subject: [PATCH 42/47] patch-1: Docs updated for Laravel v12 --- buttons-installation.md | 6 +++--- editor-installation.md | 4 +++- fractal-installation.md | 4 +++- html-installation.md | 4 +++- installation.md | 10 +++++----- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/buttons-installation.md b/buttons-installation.md index 45129b3..b6aec3e 100644 --- a/buttons-installation.md +++ b/buttons-installation.md @@ -7,8 +7,8 @@ A Laravel DataTables plugin for handling server-side exporting of table as csv, Run the following command in your project to get the latest version of the plugin: -```shell -composer require yajra/laravel-datatables-buttons:^11.0 +```bash +composer require yajra/laravel-datatables-buttons:"^12.0" ``` @@ -28,6 +28,6 @@ Open the file ```config/app.php``` and then add following service provider. After completing the step above, use the following command to publish configuration & assets: -```shell +```bash php artisan vendor:publish --tag=datatables-buttons ``` diff --git a/editor-installation.md b/editor-installation.md index 8418b18..7bed304 100644 --- a/editor-installation.md +++ b/editor-installation.md @@ -11,7 +11,9 @@ A [premium license](https://editor.datatables.net/purchase/index) is required to Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-editor:^11.0` +```bash +composer require yajra/laravel-datatables-editor:"^12.0" +``` ## Configuration diff --git a/fractal-installation.md b/fractal-installation.md index 6b53643..e717b4d 100644 --- a/fractal-installation.md +++ b/fractal-installation.md @@ -4,7 +4,9 @@ Github: https://github.com/yajra/laravel-datatables-fractal Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-fractal:^11.0` +```bash +composer require yajra/laravel-datatables-fractal:"^12.0" +``` ## Configuration > This step is optional if you are using Laravel 5.5 diff --git a/html-installation.md b/html-installation.md index 45a3f70..534ac95 100644 --- a/html-installation.md +++ b/html-installation.md @@ -6,7 +6,9 @@ Github: https://github.com/yajra/laravel-datatables-html Run the following command in your project to get the latest version of the plugin: -`composer require yajra/laravel-datatables-html:^11.0` +```bash +composer require yajra/laravel-datatables-html:"^12.0" +``` ## Configuration diff --git a/installation.md b/installation.md index dd7a8dd..9a6144d 100644 --- a/installation.md +++ b/installation.md @@ -11,7 +11,7 @@ ### Requirements -- [Laravel 11](https://github.com/laravel/framework) +- [Laravel 12](https://github.com/laravel/framework) - [jQuery DataTables v1.10.x](http://datatables.net/) @@ -22,20 +22,20 @@ Laravel DataTables can be installed with [Composer](http://getcomposer.org/doc/0 Run the following command in your project to get the latest version of the package: ```bash -composer require yajra/laravel-datatables-oracle:"^11.0" +composer require yajra/laravel-datatables-oracle:"^12.0" ``` If you are using most of the DataTables plugins like Buttons & Html, you can alternatively use the all-in-one installer package. ```bash -composer require yajra/laravel-datatables:^11.0 +composer require yajra/laravel-datatables:"^12.0" ``` ### Configuration > This step is optional if you are using Laravel 5.5+ -Open the file ```config/app.php``` or ```bootstrap/providers.php``` for Laravel 11 then add following service provider. +Open the file ```config/app.php``` or ```bootstrap/providers.php``` for Laravel 12 then add following service provider. ```php 'providers' => [ @@ -46,7 +46,7 @@ Open the file ```config/app.php``` or ```bootstrap/providers.php``` for Laravel After completing the step above, use the following command to publish configuration & assets: -``` +```bash php artisan vendor:publish --tag=datatables ``` From 2facaab955fe52f5c161ce0bd5d366d8e16d0a0a Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 5 Mar 2025 10:23:17 +0800 Subject: [PATCH 43/47] docs: v12 --- exports-installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exports-installation.md b/exports-installation.md index 79dd9fa..59afb4e 100644 --- a/exports-installation.md +++ b/exports-installation.md @@ -7,7 +7,7 @@ This package is a plugin of Laravel DataTables for handling server-side exportin ## Quick Installation ``` -composer require yajra/laravel-datatables-export -W +composer require yajra/laravel-datatables-export:"^12.0" ``` The package also requires batch job: @@ -27,4 +27,4 @@ Yajra\DataTables\ExportServiceProvider::class ``` $ php artisan vendor:publish --tag=datatables-export --force -``` \ No newline at end of file +``` From 1b426436a6038b8e2c7ba565dd54b9a213ae44b1 Mon Sep 17 00:00:00 2001 From: Romero Sarmiento Date: Wed, 1 Oct 2025 15:45:34 +0800 Subject: [PATCH 44/47] fix: Use facade --- add-column.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/add-column.md b/add-column.md index d5b984c..55191fd 100644 --- a/add-column.md +++ b/add-column.md @@ -8,7 +8,7 @@ You can add a custom column to your response by using the `addColumn` api. ## Add Column with Blade Syntax ```php -use DataTables; +use Yajra\DataTables\Facades\DataTables; Route::get('user-data', function() { $model = App\User::query(); @@ -23,7 +23,7 @@ Route::get('user-data', function() { ## Add Column with Closure ```php -use DataTables; +use Yajra\DataTables\Facades\DataTables; Route::get('user-data', function() { $model = App\User::query(); @@ -42,7 +42,7 @@ Route::get('user-data', function() { > {tip} You can use view to render your added column by passing the view path as the second argument on `addColumn` api. ```php -use DataTables; +use Yajra\DataTables\Facades\DataTables; Route::get('user-data', function() { $model = App\User::query(); @@ -64,7 +64,7 @@ Hi {{ $name }}! > {tip} Just pass the column order as the third argument of `addColumn` api. ```php -use DataTables; +use Yajra\DataTables\Facades\DataTables; Route::get('user-data', function() { $model = App\User::query(); From 595c9e880ab0c455738d153fc1adaa8f9242b349 Mon Sep 17 00:00:00 2001 From: Romero Sarmiento Date: Wed, 1 Oct 2025 16:01:33 +0800 Subject: [PATCH 45/47] fix: add 'use route' and update to facade --- html-builder-table.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html-builder-table.md b/html-builder-table.md index 285a6da..ed75ea0 100644 --- a/html-builder-table.md +++ b/html-builder-table.md @@ -8,7 +8,8 @@ Table api accepts two parameters: `$builder->table(array $attributes, $footer = ## Table Example with Footer ```php -use DataTables; +use Illuminate\Support\Facades\Route; +use Yajra\DataTables\Facades\DataTables; use Yajra\DataTables\Html\Builder; Route::get('users', function(Builder $builder) { From 946e8187fc9b85824aa446fdb3051b657533557e Mon Sep 17 00:00:00 2001 From: Romero Sarmiento Date: Wed, 1 Oct 2025 17:15:54 +0800 Subject: [PATCH 46/47] fix: update documentation by adding use User and DB --- filter-column.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/filter-column.md b/filter-column.md index a0e9f88..2fd0b5d 100644 --- a/filter-column.md +++ b/filter-column.md @@ -5,10 +5,11 @@ To achieve this, you can use `filterColumn` api. ```php use DataTables; -use DB; +use Illuminate\Support\Facades\DB; +use App\User; Route::get('user-data', function() { - $model = App\User::select([ + $model = User::query()->select([ 'id', DB::raw("CONCAT(users.first_name,'-',users.last_name) as fullname"), 'email', From 4416fa191189e5d39acb530def619547f550adce Mon Sep 17 00:00:00 2001 From: Romero Sarmiento Date: Wed, 1 Oct 2025 17:20:20 +0800 Subject: [PATCH 47/47] fix: update sample code by using Facades --- filter-column.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter-column.md b/filter-column.md index 2fd0b5d..81e4734 100644 --- a/filter-column.md +++ b/filter-column.md @@ -4,7 +4,7 @@ In some cases, we need to implement a custom search for a specific column. To achieve this, you can use `filterColumn` api. ```php -use DataTables; +use Yajra\DataTables\Facades\DataTables; use Illuminate\Support\Facades\DB; use App\User;