Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Recommended

While the package is very customisable, and supports a number of different approaches. The below is the recommended approach, that gives the best performance for the tables:

Installation

1composer require rappasoft/laravel-livewire-tables

Publish the Tables Config

1php artisan vendor:publish --tag="livewire-tables-config"

Livewire Tables Config Updates

Update the published Livewire Tables Config (config/livewire-tables.php) and set the following to false:

1/**
2 * Cache Rappasoft Frontend Assets
3 */
4'cache_assets' => false,
5 
6/**
7 * Enable or Disable automatic injection of core assets
8 */
9'inject_core_assets_enabled' => false,
10 
11/**
12 * Enable or Disable automatic injection of third-party assets
13 */
14'inject_third_party_assets_enabled' => false,
15 
16/**
17 * Enable Blade Directives (Not required if automatically injecting or using bundler approaches)
18 */
19'enable_blade_directives' => false,

Bundling the Assets

As you have now told the package not to inject the assets, add the following to your resources/js/app.js file:

1import '../../vendor/rappasoft/laravel-livewire-tables/resources/imports/laravel-livewire-tables-all.js';

Update Layouts

Ensure that your layouts do not reference any of the following blade directives, as these are not required with the above approach

1<!-- Adds the Core Table Styles -->
2@rappasoftTableStyles
3
4<!-- Adds any relevant Third-Party Styles (Used for DateRangeFilter (Flatpickr) and NumberRangeFilter) -->
5@rappasoftTableThirdPartyStyles
6
7<!-- Adds the Core Table Scripts -->
8@rappasoftTableScripts
9
10<!-- Adds any relevant Third-Party Scripts (e.g. Flatpickr) -->
11@rappasoftTableThirdPartyScripts

Tailwind Specific

If using Tailwind, you should update your tailwind.config.js file, adding the following to the "content" section under module.exports. This ensures that the Livewire Tables specific core classes are included.

1'./vendor/rappasoft/laravel-livewire-tables/resources/views/*.blade.php',
2'./vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php',

It is also recommended to add the paths to any Livewire Tables components, for example:

1'./app/Livewire/*.php',
2'./app/Livewire/**/*.php',

So that any classes used in setTdAttributes or similar are included!

Run your build process

1npm run build

Clear Cached Views

1php artisan view:clear

You may of course run view:cache at this point.