{"id":15016976,"url":"https://github.com/okipa/laravel-table","last_synced_at":"2025-05-15T15:04:13.850Z","repository":{"id":34132520,"uuid":"170023060","full_name":"Okipa/laravel-table","owner":"Okipa","description":"Generate tables from Eloquent models.","archived":false,"fork":false,"pushed_at":"2024-06-07T15:22:10.000Z","size":1607,"stargazers_count":561,"open_issues_count":8,"forks_count":71,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-07T17:06:45.522Z","etag":null,"topics":["generate","generation","generator","html","laravel","list","lists","php","table","tables"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Okipa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Okipa","ko_fi":"arthurlorent","custom":"https://paypal.me/arthurlorent"}},"created_at":"2019-02-10T20:25:40.000Z","updated_at":"2025-04-07T10:01:34.000Z","dependencies_parsed_at":"2023-11-16T12:25:16.640Z","dependency_job_id":"bcc7d18d-2c57-4f2f-ae90-fdcca8aaae00","html_url":"https://github.com/Okipa/laravel-table","commit_stats":{"total_commits":152,"total_committers":8,"mean_commits":19.0,"dds":0.5526315789473684,"last_synced_commit":"9cd555c2168840fd7abd977a512696d56f76e5fd"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Okipa%2Flaravel-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Okipa%2Flaravel-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Okipa%2Flaravel-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Okipa%2Flaravel-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Okipa","download_url":"https://codeload.github.com/Okipa/laravel-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694875,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generate","generation","generator","html","laravel","list","lists","php","table","tables"],"created_at":"2024-09-24T19:49:38.399Z","updated_at":"2025-04-07T17:07:02.132Z","avatar_url":"https://github.com/Okipa.png","language":"PHP","funding_links":["https://github.com/sponsors/Okipa","https://ko-fi.com/arthurlorent","https://paypal.me/arthurlorent"],"categories":[],"sub_categories":[],"readme":"## Package looking for co-maintainers\n\nI've been quite busy professionally lately and I'm currently looking for one or more co-maintainers to help me to maintain and develop this package.\n\nCurrent roadmap:\n* PR reviewing\n* Livewire 3 compatibility\n* Tailwind 3 compatibility\n\nPlease contact me at arthur[dot]lorent[at]gmail.com to apply.\n\n------\n\n![Laravel Table](/docs/laravel-table.png)\n\u003cp style=\"text-align: center\"\u003e\n    \u003ca href=\"https://github.com/Okipa/laravel-table/releases\" title=\"Latest Stable Version\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/release/Okipa/laravel-table.svg?style=flat-square\" alt=\"Latest Stable Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/Okipa/laravel-table\" title=\"Total Downloads\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/dt/okipa/laravel-table.svg?style=flat-square\" alt=\"Total Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Okipa/laravel-table/actions\" title=\"Build Status\"\u003e\n        \u003cimg src=\"https://github.com/Okipa/laravel-table/actions/workflows/ci.yml/badge.svg\" alt=\"Build Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://coveralls.io/github/Okipa/laravel-table?branch=master\" title=\"Coverage Status\"\u003e\n        \u003cimg src=\"https://coveralls.io/repos/github/Okipa/laravel-table/badge.svg?branch=master\" alt=\"Coverage Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"/LICENSE.md\" title=\"License: MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" alt=\"License: MIT\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n![Generate tables from Eloquent models](docs/screenshot.png)\n\nSave time and easily render tables in your views from Eloquent models.\n\nTables can be generated under the following UI frameworks:\n* Bootstrap 5\n* Bootstrap 4\n* TailwindCSS 3 (upcoming feature)\n\nFound this package helpful? Please consider supporting my work!\n\n[![Donate](https://img.shields.io/badge/Buy_me_a-Ko--fi-ff5f5f.svg)](https://ko-fi.com/arthurlorent)\n[![Donate](https://img.shields.io/badge/Donate_on-PayPal-green.svg)](https://paypal.me/arthurlorent)\n \n## Compatibility\n\n| Laravel version                                      | Livewire version | PHP version                  | Package version |\n|------------------------------------------------------|------------------|------------------------------|-----------------|\n| ^9.0 \u0026#124; ^10.0                                    | ^2.0             | 8.1.* \u0026#124; 8.2.*           | ^5.3            |\n| ^8.0 \u0026#124; ^9.0                                     | ^2.0             | ^8.1                         | ^5.0            |\n| ^7.0 \u0026#124; ^8.0                                     | X                | ^7.4 \u0026#124; ^8.0             | ^4.0            |\n| ^7.0 \u0026#124; ^8.0                                     | X                | ^7.4 \u0026#124; ^8.0             | ^3.0            |\n| ^6.0 \u0026#124; ^7.0                                     | X                | ^7.4 \u0026#124; ^8.0             | ^2.0            |\n| ^5.8 \u0026#124; ^6.0 \u0026#124; ^7.0                         | X                | ^7.2 \u0026#124; ^7.3 \u0026#124; ^7.4 | ^1.3            |\n| ^5.5 \u0026#124; ^5.6 \u0026#124; ^5.7 \u0026#124; ^5.8 \u0026#124; ^6.0 | X                | ^5.8 \u0026#124; ^7.1             | ^1.0            |\n\n## Upgrade guide\n\n* [From V4 to V5](/docs/upgrade-guides/from-v4-to-v5.md)\n* [From V3 to V4](/docs/upgrade-guides/from-v3-to-v4.md)\n* [From V2 to V3](/docs/upgrade-guides/from-v2-to-v3.md)\n* [From V1 to V2](/docs/upgrade-guides/from-v1-to-v2.md)\n\n## Usage\n\nCreate your table with the following command:\n\n```bash\nphp artisan make:table UsersTable --model=App/Models/User\n```\n\nConfigure your table in the `UsersTable` generated class, which can be found in the `app\\Tables` directory:\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Column;\nuse Okipe\\LaravelTable\\Formatters\\Date;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n\n    protected function columns(): array\n    {\n        return [\n            Column::make('id')-\u003esortable(),\n            Column::make('name')-\u003esearchable()-\u003esortable(),\n            Column::make('email')-\u003esearchable()-\u003esortable(),\n            Column::make('created_at')\n                -\u003eformat(new DateFormatter('d/m/Y H:i', 'Europe/Paris'))\n                -\u003esortable(),\n            Column::make('updated_at')\n                -\u003eformat(new DateFormatter('d/m/Y H:i', 'Europe/Paris'))\n                -\u003esortable()\n                -\u003esortByDefault('desc'),\n        ];\n    }\n}\n```\n\nAnd display it in a view:\n\n```blade\n\u003clivewire:table :config=\"App\\Tables\\UsersTable::class\"/\u003e\n```\n\n## Table of contents\n\n* [Installation](#installation)\n* [Configuration](#configuration)\n* [Templates](#templates)\n* [Translations](#translations)\n* [How to](#how-to)\n  * [Create table configuration](#create-table-configurations)\n  * [Display tables in views](#display-tables-in-views)\n  * [Pass external data to your tables](#pass-external-data-to-your-tables)\n  * [Generate tables from Eloquent models](#generate-tables-from-eloquent-models)\n  * [Override native selects behaviour on your tables](#override-native-selects-behaviour-on-your-tables)\n  * [Add query instructions on tables](#add-query-instructions-on-tables)\n  * [Handle tables number of rows per page, pagination and navigation status](#handle-tables-number-of-rows-per-page-pagination-and-navigation-status)\n  * [Set conditional row class](#set-conditional-row-class)\n  * [Setup table filters](#setup-table-filters)\n  * [Define table head action](#define-table-head-action)\n  * [Define table bulk actions](#define-table-bulk-actions)\n  * [Define table row actions](#define-table-row-actions)\n  * [Declare columns on tables](#declare-columns-on-tables)\n  * [Format column values](#format-column-values)\n  * [Define column actions](#define-column-actions)\n  * [Configure columns searching](#configure-columns-searching)\n  * [Configure columns sorting](#configure-columns-sorting)\n  * [Allow columns to be reordered from drag and drop action](#allow-columns-to-be-reordered-from-drag-and-drop-action)\n  * [Declare results on tables](#declare-results-on-tables)\n  * [Set up a few lines of JavaScript](#set-up-a-few-lines-of-javascript)\n  * [Trigger Livewire events on table load](#trigger-livewire-events-on-table-load)\n  * [Interact with your tables from events](#interact-with-your-tables-from-events)\n* [Testing](#testing)\n* [Changelog](#changelog)\n* [Contributing](#contributing)\n* [Credits](#credits)\n* [Licence](#license)\n\n## Installation\n\n* Install the package with composer:\n\n```bash\ncomposer require okipa/laravel-table\n```\n\nThis package uses [Livewire](https://laravel-livewire.com) under the hood and its installation is required.\n\nYou'll have to follow the [installation instructions](https://laravel-livewire.com/docs/installation) if Livewire is not already installed on your project.\n\n## Configuration\n\nOptionally publish the package configuration:\n\n```bash\nphp artisan vendor:publish --tag=laravel-table:config\n```\n\n## Templates\n\nOptionally publish the package templates:\n\n```bash\nphp artisan vendor:publish --tag=laravel-table:views\n```\n\n## Translations\n\nAll words and sentences used in this package are translatable.\n\nSee how to translate them on the Laravel official documentation: https://laravel.com/docs/localization#using-translation-strings-as-keys.\n\nHere is the list of the words and sentences available for translation:\n\nStatus\n* `Loading in progress...`\n* `No results were found.`\n* `You can rearrange the order of the items in this list using a drag and drop action.`\n* `Reset filters`\n* `Yes`\n* `No`\n* `Search by:`\n* `Reset research`\n* `Number of rows per page`\n* `Sort ascending`\n* `Sort descending`\n* `Actions`\n* `Bulk Actions`\n* `Create`\n* `Add`\n* `Show`\n* `Edit`\n* `Destroy`\n* `Activate`\n* `Deactivate`\n* `Verify Email`\n* `Unverify Email`\n* `Toggle On`\n* `Toggle Off`\n* `Are you sure you want to execute the action :action on the line #:primary?`\n* `Are you sure you want to execute the action :action on the field :attribute from the line #:primary?`\n* `Are you sure you want to execute the action :action on the :count selected lines?`\n* `The line #:primary does not allow the action :action and will not be affected.`\n* `:count selected lines do not allow the action :action and will not be affected.`\n* `The action :action has been executed on the line #:primary.`\n* `The action :action has been executed on the field :attribute from the line #:primary.`\n* `The action :action has been executed on the :count selected lines.`\n* `The line #:primary does not allow the action :action and was not affected.`\n* `:count selected lines do not allow the action :action and were not affected.`\n* `The list has been reordered.`\n* `Showing results \u003cb\u003e:start\u003c/b\u003e to \u003cb\u003e:stop\u003c/b\u003e on \u003cb\u003e:total\u003c/b\u003e`\n\n## How to\n\n### Create table configurations\n\nGenerate a table configuration by executing this command : `php artisan make:table UsersTable`.\n\nIf you want to generate a configuration with a predefined model, just add this option at the end: `--model=App/Models/User`.\n\nYou'll find all your generated table configurations in the `app/Tables` directory.\n\n### Display tables in views\n\nJust call this Livewire component in your view with your configuration class name passed in the `config` parameter.\n\n```blade\n\u003clivewire:table :config=\"App\\Tables\\UsersTable::class\"/\u003e\n```\n\n### Pass external data to your tables\n\nIn case you have specific attributes to transmit to your table configuration, you should pass them to the `configParams` parameter.\n\nThis could be useful when you have to transmit external information to your table.\n\n```blade\n\u003clivewire:table :config=\"App\\Tables\\UsersTable::class\" :configParams=\"['categoryId' =\u003e 1]\"/\u003e\n```\n\nYou should then declare the passed attributes as `public` attributes your table configuration.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    // You will now be able to use the provided `$this-\u003ecategoryId` category ID in your table configuration.\n    public int $categoryId;\n\n    // ...\n}\n```\n\n### Generate tables from Eloquent models\n\nTo generate a table from an Eloquent model, you'll just have to call the `model` method on your table.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n}\n```\n\n### Override native selects behaviour on your tables\n\nYou may want to override native HTML select components behaviour on your tables.\n\nYou will be able to add a data attribute (which is known as the best practice to add extra features to a HTML component) to all the HTML select components displayed on your tables by defining an array of HTML attribute as value for the `laravel-table.html_select_components_attributes` config key.\n\n```php\n// `data-selector` HTML attribute will be appended to all tables HTML select components.\n'html_select_components_attributes' =\u003e ['data-selector' =\u003e true],\n```\n\n### Add query instructions on tables\n\nTo add specific query instructions on tables, use the available `query` method.\n\nYou'll be able to set specific Eloquent instructions by passing a closure parameter to the `query` method on your table.\n\nThis closure will allow you to manipulate a `\\Illuminate\\Database\\Eloquent\\Builder $query` argument.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003equery(fn(Builder $query) =\u003e $query-\u003ewhere('category_id', 1));\n    }   \n}\n```\n\n### Handle tables number of rows per page, pagination and navigation status\n\nYou have two ways to allow or disallow users to choose the number of rows that will be displayed per page:\n* Activate or deactivate it globally from the `laravel-table.enable_number_of_rows_per_page_choice` config boolean value\n* Override global activation status by executing the `enableNumberOfRowsPerPageChoice()` method on your table\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003eenableNumberOfRowsPerPageChoice(false);\n    }\n}\n```\n\nFollowing the same logic, you'll be able to define the number of rows per page options that will be available for selection:\n* Set options globally from the `laravel-table.number_of_rows_per_page_default_options` config array value\n* Override global options by executing the `numberOfRowsPerPageOptions()` method on your table\n\nThe first available option will be automatically selected and applied on table initialization.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            // Table will display 5 rows on initialization and will allow displaying 10, 15, 20 or 25 rows.\n            -\u003enumberOfRowsPerPageOptions([5, 10, 15, 20, 25]);\n    }\n}\n```\n\nPagination will automatically be handled, according to the number of rows to display and the total number of rows, as well as a navigation status.\n\nBoth of them will be displayed in the table footer.\n\n### Set conditional row class\n\nDefine conditional row class on tables by passing a closure argument to the `rowClass` method.\n\nThis closure will allow you to manipulate a `Illuminate\\Database\\Eloquent $model` argument and has to return an array of classes where the array key contains the class or classes you wish to add, while the value is a boolean expression.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003erowClass(fn(User $user) =\u003e [\n                'table-danger' =\u003e ! $user-\u003eactive,\n            ]);\n    }\n}\n```\n\n### Setup table filters\n\nConfiguring table filters will make them appear as `select` HTML components on a dedicated bar above the table.\n\nThe filters bar will not appear if no filter is declared.\n\nThis package provides the following built-in filters:\n* `ValueFilter`:\n  * Requires `string $label`, `string $attribute`, `array $options` and `bool $multiple = true` arguments on instantiation\n  * Filters the table based on whether the value of the selected options (or single option if multiple mode is disabled) is found in the given attribute\n* `RelationshipFilter`:\n  * Requires `string $label`, `string $relationship`, `array $options` and `bool $multiple = true` arguments on instantiation\n  * Filters the table based on whether the value of the selected options (or single option if multiple mode is disabled) is found in the given relationship\n* `NullFilter`\n  * Requires a `string $attribute` argument on instantiation\n  * Filters the table based on whether the value of the given attribute is `null` or not\n* `BooleanFilter`\n  * Requires `string $label` and `string $attribute` arguments on instantiation\n  * Filters the table based on whether the value of the given attribute is `true` or `false`\n\nTo use them, you'll have to pass an array to the `filters` method, containing the filter instances to declare.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Filters\\NullFilter;\nuse Okipa\\LaravelTable\\Filters\\ValueFilter;\nuse Okipa\\LaravelTable\\Filters\\BooleanFilter;\nuse Okipa\\LaravelTable\\Filters\\RelationshipFilter;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003efilters([\n                new ValueFilter('Email', 'email', User::pluck('email', 'email')-\u003etoArray()),\n                new RelationshipFilter('Categories', 'categories', UserCategory::pluck('name', 'id')-\u003etoArray()),\n                new NullFilter('Email Verified', 'email_verified_at'),\n                new BooleanFilter('Active', 'active'),\n            ]);\n    }\n}\n```\n\nYou may need to create your own filters. To do so, execute the following command: `php artisan make:table:filter MyNewFilter`.\n\nYou'll find your generated table filter in the `app/Tables/Filters` directory.\n\nYou will now be able to use your new filter in your tables.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse App\\Tables\\Filters\\MyNewFilter;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003efilters([\n                new MyNewFilter(),\n            ]);\n    }\n}\n```\n\n### Define table head action\n\nConfigure a table action that will be displayed as a button positioned at the right of the table head.\n\nIf no head action is declared, the dedicated slot for it in the table head will remain empty.\n\nThis package provides the following built-in head actions:\n* `RedirectHeadAction`:\n    * Requires `string $url`, `string $label`, `string $icon`, `array $class = ['btn', 'btn-success']` and `bool $openInNewWindow = false` arguments on instantiation\n    * Redirects to the given URL from a click on the button\n* `CreateHeadAction`:\n    * Requires `string $createUrl` and `bool $openInNewWindow = false` arguments on instantiation\n    * Instantiate a pre-configured `RedirectHeadAction` with `$createUrl` as URL, `__('Create')` as label and `config('laravel-table.icon.create')` as icon\n\nTo use one of them, you'll have to pass an instance of it to the `headAction` method.\n\nYou'll be able to chain the following method to your head action:\n* `when(bool $condition): Okipa\\LaravelTable\\Abstracts\\AbstractHeadAction`\n    * Determines whether the head action should be enabled\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\HeadActions\\AddHeadAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            // Create head action will not be available when authenticated user is not allowed to create users\n            -\u003eheadAction((new AddHeadAction(route('user.create')))-\u003ewhen(Auth::user()-\u003ecannot('create_users')));\n    }\n}\n```\n\nYou may need to create your own head actions. To do so, execute the following command: `php artisan make:table:head:action MyNewHeadAction`.\n\nYou'll find your generated table head action in the `app/Tables/HeadActions` directory.\n\nYou will now be able to use your new head action in your tables.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse App\\Tables\\HeadActions\\MyNewHeadAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003eheadAction(new MyNewHeadAction());\n    }\n}\n```\n\n### Define table bulk actions\n\nConfigure table bulk actions that will be available in a dropdown positioned at the left of the table head.\n\nIf no bulk action is declared on your table, the dedicated column will not be displayed.\n\n**Important note:** [you'll have to set up a few lines of javascript](#set-up-a-few-lines-of-javascript) to allow bulk actions confirmation requests and feedback to be working properly.\n\nThis package provides the built-in following bulk actions:\n* `VerifyEmailBulkAction`:\n    * Requires a `string $attribute` argument on instantiation\n    * Update the given attribute with the current datetime for all selected lines\n* `CancelEmailVerificationBulkAction`:\n    * Requires a `string $attribute` argument on instantiation\n    * Update the given attribute to `null` for all selected lines\n* `ActivateBulkAction`:\n    * Requires a `string $attribute` argument on instantiation\n    * Update the given attribute to `true` for all selected lines\n* `DeactivateBulkAction`:\n    * Requires a `string $attribute` argument on instantiation\n    * Update the given attribute to `false` for all selected lines\n* `DestroyBulkAction`:\n    * Destroys all the selected lines\n\nTo use them, you'll have to pass a closure parameter to the `bulkActions` method. This closure will allow you to manipulate a `Illuminate\\Database\\Eloquent $model` argument and has to return an array containing bulk action instances.\n\nYou'll be able to chain the following methods to your bulk actions:\n* `when(bool $condition): Okipa\\LaravelTable\\Abstracts\\AbstractBulkAction`\n    * Determines whether the bulk action should be enabled on the table rows\n* `confirmationQuestion(string|false $confirmationQuestion): Okipa\\LaravelTable\\Abstracts\\AbstractBulkAction`\n    * Overrides the default action confirmation message\n* `feedbackMessage(string|false $feedbackMessage): Okipa\\LaravelTable\\Abstracts\\AbstractBulkAction`:\n    * Overrides the default action feedback message\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\BulkActions\\DestroyBulkAction;\nuse Okipa\\LaravelTable\\BulkActions\\ActivateBulkAction;\nuse Okipa\\LaravelTable\\BulkActions\\DeactivateBulkAction;\nuse Okipa\\LaravelTable\\BulkActions\\VerifyEmailBulkAction;\nuse Okipa\\LaravelTable\\BulkActions\\CancelEmailVerificationBulkAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003ebulkActions(fn(User $user) =\u003e [\n                new VerifyEmailBulkAction('email_verified_at'),\n                new CancelEmailVerificationBulkAction('email_verified_at'),\n                new ActivateBulkAction('active'),\n                new DeactivateBulkAction('active'),\n                (new DestroyBulkAction())\n                    // Destroy action will not be available for authenticated user\n                    -\u003ewhen(Auth::user()-\u003eisNot($user))\n                    // Override the action default confirmation question\n                    // Or set `false` if you do not want to require any confirmation for this action\n                    -\u003econfirmationQuestion('Are you sure you want to delete selected users ?')\n                    // Override the action default feedback message\n                    // Or set `false` if you do not want to trigger any feedback message for this action\n                    -\u003efeedbackMessage('Selected users have been deleted.'),\n            ]);\n    }\n}\n```\n\nYou may need to create your own bulk actions. To do so, execute the following command: `php artisan make:table:bulk:action MyNewBulkAction`.\n\nYou'll find your generated table bulk actions in the `app/Tables/BulkActions` directory.\n\nYou will now be able to use your new bulk action in your tables.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse App\\Tables\\BulkActions\\MyNewBulkAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003ebulkActions(fn(User $user) =\u003e [\n                new MyNewBulkAction(),\n            ]);\n    }\n}\n```\n\n### Define table row actions\n\nConfigure row actions on your table that will be displayed at the end of each row.\n\nIf no row action is declared on your table, the dedicated `Actions` column at the right of the table will not be displayed.\n\n**Important note:** [you'll have to set up a few lines of javascript](#set-up-a-few-lines-of-javascript) to allow row actions confirmation requests and feedback to be working properly.\n\nThis package provides the built-in following row actions:\n* `RedirectRowAction`:\n    * Requires `string $url`, `string $title`, `string $icon`, `array $class = ['link-info']`, `string|null $defaultConfirmationQuestion = null`, `string|null $defaultFeedbackMessage = null` and `bool $openInNewWindow = false` arguments on instantiation\n    * Redirects to the given URL from a click on the link\n* `ShowRowAction`:\n  * Requires `string $showUrl` and `bool $openInNewWindow = false` arguments on instantiation\n  * Instantiate a pre-configured `RedirectRowAction` with `$showUrl` as URL, `__('Show')` as label and `config('laravel-table.icon.show')` as icon\n* `EditRowAction`:\n  * Requires a `string $editUrl` argument on instantiation\n  * Redirects to the model edit page on click\n* `DestroyRowAction`:\n  * Destroys the line after being asked to confirm\n\nTo use them, you'll have to pass a closure parameter to the `rowActions` method. This closure will allow you to manipulate a `Illuminate\\Database\\Eloquent $model` argument and has to return an array containing row action instances.\n\nYou'll be able to chain the same methods as for a bulk action =\u003e [See bulk actions configuration](#define-table-bulk-actions).\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\RowActions\\EditRowAction;\nuse Okipa\\LaravelTable\\RowActions\\ShowRowAction;\nuse Okipa\\LaravelTable\\RowActions\\DestroyRowAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003erowActions(fn(User $user) =\u003e [\n                new ShowRowAction(route('user.show', $user)),\n                new EditRowAction(route('user.edit', $user)),\n                (new DestroyRowAction())\n                    // Destroy action will not be available for authenticated user\n                    -\u003ewhen(Auth::user()-\u003eisNot($user))\n                    // Override the action default confirmation question\n                    // Or set `false` if you do not want to require any confirmation for this action\n                    -\u003econfirmationQuestion('Are you sure you want to delete user ' . $user-\u003ename . '?')\n                    // Override the action default feedback message\n                    // Or set `false` if you do not want to trigger any feedback message for this action\n                    -\u003efeedbackMessage('User ' . $user-\u003ename . ' has been deleted.'),\n            ]);\n    }\n}\n```\n\nYou may need to create your own row actions. To do so, execute the following command: `php artisan make:table:row:action MyNewRowAction`.\n\nYou'll find your generated table row actions in the `app/Tables/RowActions` directory.\n\nYou will now be able to use your new row action in your tables.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse App\\Tables\\RowActions\\MyNewRowAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            -\u003erowActions(fn(User $user) =\u003e [\n                new MyNewRowAction(),\n            ]);\n    }\n}\n```\n\nYou may need your row actions to be confirmed before they'll be executed and to trigger feedback messages.\n\nYou'll have to configure them in the same way you did for [bulk actions](#define-table-bulk-actions).\n\n### Declare columns on tables\n\nDeclare columns on tables with the `columns` method available in your generated table configuration, from which you'll have to return an array of column instances.\n\nTo declare columns, just use the static `make` method that will await a `string $attribute` argument. This attribute will be used to get the default cell value.\n\nBy default, the column title will be defined to `__('validation.attributes.\u003cattribute\u003e')` in order to reuse attributes translations.\n\nIf you need to, you may use the `title` method that will await a `string $title` argument to set a specific column title that will override the default one.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Column;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Column attribute set to `id`, column value set from `$user-\u003eid` and colum title set to `__('validation.attributes.id')`\n            Column::make('id'),\n            // Column attribute set to `name`, value set from `$user-\u003ename` and column title set to `Username`\n            Column::make('name')-\u003etitle('Username'),\n        ];\n    }\n}\n```\n\n### Format column values\n\nYou'll sometimes need to apply specific formatting for your columns. There are a few ways to achieve this.\n\nFor specific cases, you should pass a closure parameter to the `format` method on your column.\n\nThis closure will allow you to manipulate a `Illuminate\\Database\\Eloquent $model` argument.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Column;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Value set from `$user-\u003eid`\n            Column::make('id'),\n            // Value set from closure\n            Column::make('username')\n                -\u003eformat(fn(User $user) =\u003e '\u003cb\u003e ' . $user-\u003ecompanies-\u003eimplode('name', ', ') . '\u003c/b\u003e'),\n        ];\n    }\n}\n```\n\nIf you want to apply the same formatting treatment repeatedly, you should create a formatter with the following command: `php artisan make:table:formatter NewFormatter`.\n\nYou'll find the generated formatter in the `app\\Table\\Formatters` directory.\n\nYou'll be able to reuse this formatter in your tables.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Column;\nuse App\\Tables\\Formatters\\NewFormatter;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            Column::make('id'),\n            Column::make('name')-\u003eformat(new NewFormatter()),\n        ];\n    }\n}\n```\n\nThis package provides the following built-in formatters :\n* `BooleanFormatter`:\n  * Displays the `config('laravel-table.icon.active')` active icon or the `config('laravel-table.icon.inactive')` inactive icon from a `boolean` value\n* `DateFormatter`:\n  * Requires `string $format` and `string $timezone` arguments on instantiation\n  * Displays a formatted string from a `date` or `datetime` value\n* `StrLimitFormatter`:\n  * Allows optional `int $limit` and `string $end` arguments on instantiation\n  * Displays a truncated string with a title allowing to see the full string on hover\n\n### Define column actions\n\nConfigure column actions on your table that will be displayed on their own cells.\n\nColumn actions have a lot in common with row actions.\n\n**Important note:** [you'll have to set up a few lines of javascript](#set-up-a-few-lines-of-javascript) to allow column actions confirmation requests and feedback to be working properly.\n\nThis package provides the built-in following actions:\n* `ToggleBooleanColumnAction`:\n  * Toggles the email verification status\n* `ToggleBooleanColumnAction`:\n  * Toggles a boolean value\n\nTo use them, you'll have to pass a closure parameter to the `action` method. This closure will allow you to manipulate a `Illuminate\\Database\\Eloquent $model` argument and has to return an `AbstractColumnAction` instance.\n\nYou'll be able to chain the same methods as for a bulk action =\u003e [See bulk actions configuration](#define-table-bulk-actions).\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\ColumnActions\\ToggleBooleanColumnAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\nuse Okipa\\LaravelTable\\ColumnActions\\ToggleBooleanColumnAction;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            Column::make('id'),\n            Column::make('email_verified_at')\n                // ToggleBooleanColumnAction action will not trigger any feedback message\n                -\u003eaction(fn(User $user) =\u003e (new ToggleBooleanColumnAction()-\u003efeedbackMessage(false))\n            Column::make('active')\n                // ToggleBooleanColumnAction action will not be available for authenticated user\n                -\u003eaction(fn(User $user) =\u003e (new ToggleBooleanColumnAction())-\u003ewhen(Auth::user()-\u003eisNot($user))),\n        ];\n    }\n}\n```\n\nYou may need to create your own column actions. To do so, execute the following command: `php artisan make:table:column:action MyNewColumnAction`.\n\nYou'll find your generated table column actions in the `app/Tables/ColumnActions` directory.\n\nYou will now be able to use your new column action in your tables.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse App\\Tables\\ColumnActions\\MyNewColumnAction;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n\n    protected function columns(): array\n    {\n        return [\n            Column::make('id'),\n            Column::make('action')-\u003eaction(fn() =\u003e new MyNewColumnAction()),\n        ];\n    }\n}\n```\n\nYou may need your column actions to be confirmed before they'll be executed and to trigger feedback messages.\n\nYou'll have to configure them in the same way you did for [bulk actions](#define-table-bulk-actions). \n\n### Configure columns searching\n\nAllow searching on columns by calling the `searching` method.\n\nWhen searchable fields are set, a search input will appear in the table head.\n\nSearchable column titles will be used to indicate which field can be searched on the search input placeholder.\n\nBy default, searching will be applied to columns defined keys.\n\n```php\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Column will not be searchable\n            Column::make('id'),\n            // Table will be searchable from `$user-\u003ename`\n            Column::make('name')-\u003esearchable(),\n        ];\n    }\n}\n```\n\nYou will be able to set up a custom searching behaviour by passing a closure to the `searchable` method.\n\nThis closure will be executed when searching will be triggered on the table and will allow you to manipulate a `Illuminate\\Database\\Eloquent\\Builder $query` argument.\n\n```php\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Column will not be searchable\n            Column::make('id'),\n            // Column will be searchable using this closure\n            Column::make('owned_companies')\n                // ... Your custom formatting here\n                -\u003esearchable(fn(Builder $query, string $searchBy) =\u003e $query-\u003ewhereRelation(\n                    'companies',\n                    'name',\n                    'LIKE',\n                    '%' . $searchBy . '%'\n                ),\n        ];\n    }\n}\n```\n\n### Configure columns sorting\n\nAllow sorting on columns by calling the `sortable` method.\n\nSortable columns will display clickable sort icons before their titles that will trigger ascending or descending sorting.\n\nBy default, sorting will be applied to columns defined keys.\n\n```php\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Column will not be sortable\n            Column::make('id'),\n            // Column will be sortable from `$user-\u003ename`\n            Column::make('name')-\u003esortable(),\n        ];\n    }\n}\n```\n\nTo sort a column by default, use the `sortByDefault` column method, which will allow you to pass a `string $direction` argument.\n\nYou can sort by default a column that is not sortable.\n\n```php\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Column will not be sortable\n            Column::make('id'),\n            // Column will be sorted descending by default on `$user-\u003ename`\n            Column::make('name')-\u003esortByDefault('desc'),\n        ];\n    }\n}\n```\n\nYou will be able to set up a custom sorting behaviour by passing a closure to the `sortable` method.\n\nThis closure will be executed when sorting will be triggered on the column and will allow you to manipulate a `Illuminate\\Database\\Eloquent\\Builder $query` and a `string $sortDir` arguments (`asc` or `desc`).\n\n```php\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            // Column will not be sortable\n            Column::make('id'),\n            // Column will be sortable from this closure\n            Column::make('companies_count') \n                // Custom formatting...\n                -\u003esortable(fn(Builder $query, string $sortDir) =\u003e $query\n                    -\u003ewithCount('companies')\n                    -\u003eorderBy('companies_count', $sortDir)),\n        ];\n    }\n}\n```\n\n### Allow columns to be reordered from drag and drop action\n\nAllow columns to be reordered from drag and drop action by calling the `reorderable` method on your table.\n\nThis method will await a first `string $attribute` argument, an optional second `string $title` argument, and an optional third `string $sortDirByDefault` argument (accepting `asc` or `desc` values).\n\n**Important notes:**\n* [You'll have to set up a few lines of javascript](#set-up-a-few-lines-of-javascript) to allow reorder action feedback to be working properly\n* You'll have to install the [Livewire Sortable Plugin](https://github.com/livewire/sortable), that will handle the drag and drop utility for us\n\nActivating this feature will:\n* Prepend a new column that will display the drag-and-drop icon defined in the `laravel-table.icon.drag_drop` config value, followed by the defined model order attribute value\n* Sort the rows from the defined model order attribute (`asc` by default)\n* Disable all other columns sorting as it is not compatible with drag-and-drop reordering\n* And of course, enable the drag-and-drop columns reordering by adding all the **Livewire Sortable Plugin** necessary markup\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            // A new column will display the drag-and-drop icon, followed by the `position` attribute value\n            // Rows will be sorted from the `position` model attribute and all other columns sorting will be disable\n            -\u003ereorderable('position');\n    }\n}\n```\n\nTip: if you are using packages like [spatie/eloquent-sortable](https://github.com/spatie/eloquent-sortable) to handle your Eloquent models sorting behaviour with a [grouping query](https://github.com/spatie/eloquent-sortable#grouping), you'll have to also set this grouping query in the [table query instruction](#add-query-instructions-on-tables).\n\n### Declare results on tables\n\nTo display results, you'll have to return an array of result instances from the `results` method available in your generated table configuration.\n\nIf no result is declared, their dedicated space will remain empty.\n\nResults should be declared this way:\n1. Create a `Result` instance with the static `make` method\n2. Chain the `title` method that will await a `string $title` argument\n3. Chain the `format` method that will await a closure, letting you manipulate `Illuminate\\Database\\Query\\Builder $totalRowsQuery` and `Illuminate\\Support\\Collection $displayedRowsCollection` params\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Okipa\\LaravelTable\\Column;\nuse Okipa\\LaravelTable\\Result;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Database\\Query\\Builder;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()-\u003emodel(User::class);\n    }\n    \n    protected function columns(): array\n    {\n        return [\n            Column::make('id'),\n        ];\n    }\n    \n    protected function results(): array\n    {\n        return [\n            // This result uses the first $totalRowsQuery closure param to compute its value.\n            // In this example, all users contained in database with unverified email will be count.\n            Result::make()\n                -\u003etitle('Total of users with unverified email')\n                -\u003eformat(static fn(Builder $totalRowsQuery) =\u003e $totalRowsQuery\n                    -\u003ewhereNull('email_verified_at')\n                    -\u003ecount()),\n            // This result uses the second $displayedRowsCollection closure param to compute its value.\n            // In this example, all displayed inactive users will be count.\n            Result::make()\n                -\u003etitle('Displayed inactive users')\n                -\u003eformat(static fn(\n                    Builder $totalRowsQuery,\n                    Collection $displayedRowsCollection\n                ) =\u003e $displayedRowsCollection-\u003ewhere('active', false)-\u003ecount()),\n        ];\n    }\n}\n```\n\n### Set up a few lines of JavaScript\n\nYou'll have to add few Javascript lines to your project once this package is installed, in order to allow confirmation requests and actions feedback to be working properly. \n\nWhen an action is requesting the user confirmation, it will not be directly executed. A `table:action:confirm` Livewire event will be emitted instead with the following parameters:\n1. The action type\n2. The action identifier\n3. The model primary key related to your action\n4. The `$confirmationQuestion` attribute from your action\n\nAs you will see on the provided snippet below, the 4th param of this event is the only one you'll have to use in order to request the user confirmation. The 3 first params are only there to be sent back to a new event when the action is confirmed by the user. Just ignore them in your treatment.\n\nYou will have to intercept this event from your own JS script and prompt a confirmation request.\n\nWhen the action is confirmed by the user, you'll have to emit a new `laraveltable:action:confirmed` Livewire event that will trigger the action execution. You'll have to pass it the 3 first arguments provided in the `table:action:confirm` event:\n1. The action type\n2. The action identifier\n3. The model primary key related to your action\n\nHere is an JS snippet to show you how to proceed:\n\n```javascript\n// Listen to the action confirmation request\nLivewire.on('laraveltable:action:confirm', (actionType, actionIdentifier, modelPrimary, confirmationQuestion) =\u003e {\n    // You can replace this native JS confirm dialog by your favorite modal/alert/toast library implementation. Or keep it this way!\n    if (window.confirm(confirmationQuestion)) {\n        // As explained above, just send back the 3 first argument from the `table:action:confirm` event when the action is confirmed\n        Livewire.emit('laraveltable:action:confirmed', actionType, actionIdentifier, modelPrimary);\n    }\n});\n```\n\nOnce an action is executed, a `table:action:feedback` Livewire event is triggered (it sometimes depends on the configuration of a feedback message).\n\nFollowing the same logic, you'll have to intercept it from a JS script as shown on the snippet below to provide an immediate feedback to the user:\n\n```javascript\nLivewire.on('laraveltable:action:feedback', (feedbackMessage) =\u003e {\n    // Replace this native JS alert by your favorite modal/alert/toast library implementation. Or keep it this way!\n    window.alert(feedbackMessage);\n});\n```\n\nFinally, in order to allow head `RedirectHeadAction` and `CreateHeadAction` to open link in new tab, you'll also have to add the following JS snippet:\n\n```javascript\nLivewire.on('laraveltable:link:open:newtab', (url) =\u003e {\n    window.open(url, '_blank').focus();\n});\n```\n\n### Trigger Livewire events on table load\n\nYou may want to trigger some events on table load, in order to load UI third party JS libraries for example.\n\nYou can do it using the table `emitEventsOnLoad` method, that will await an array of events.\n\n```php\nnamespace App\\Tables;\n\nuse App\\Models\\User;\nuse Okipa\\LaravelTable\\Table;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Okipa\\LaravelTable\\Abstracts\\AbstractTableConfiguration;\n\nclass UsersTable extends AbstractTableConfiguration\n{\n    protected function table(): Table\n    {\n        return Table::make()\n            -\u003emodel(User::class)\n            // This event will be loaded each time your table will be rendered\n            // in order to keep your UI third party libraries rendering,\n            // even when its HTML is refreshed.\n            -\u003eemitEventsOnLoad(['js:selector:init' =\u003e ['some', 'params']]);\n    }   \n}\n```\n\n### Interact with your tables from events\n\nYou will be able to interact with your tables by sending them the following Livewire events:\n* `laraveltable:refresh`\n  * Allows optional `array $configParams = []`, and `array $targetedConfigs = []` arguments\n  * Refreshes your tables and (optionaly) set [external table config data](#pass-external-data-to-your-tables) with (optional) table targeting to only refresh specific ones (empty `$targetedConfigs` array will refresh all tables one page) \n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n* [Arthur LORENT](https://github.com/okipa)\n* [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokipa%2Flaravel-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokipa%2Flaravel-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokipa%2Flaravel-table/lists"}