ProjectLaravelFeatured

Laravel Inertia Datatables

A Laravel Composer package for building server-side datatables with search, filters, date ranges, sorting, relations, pagination, and collection output.

Stack

Laravel
PHP
Composer
Eloquent
Datatable
Year
2026

Laravel Inertia Datatables

Beta Notice

This package is currently in beta. It is usable, but the public API may still change before v1.0.0.

raprmdn/laravel-inertia-datatables is a Laravel Composer package for building server-side datatables.

It provides a backend-first query builder for handling common datatable features such as search, filters, date ranges, sorting, relations, pagination, and collection output.

Package: Packagist

Source Code: GitHub

Background

This package was extracted from my original project-based implementation: Laravel Inertia Datatable

The original version was built as a complete Laravel, Inertia, React, Tailwind, and shadcn/ui project. After improving the implementation, I separated the reusable backend datatable logic into a standalone Composer package.

The goal is to make the datatable logic reusable across Laravel applications, not locked into one project structure.

Features

  • Server-side search
  • Column filters
  • Date range filters
  • Sorting
  • Allowed filters
  • Allowed sorts
  • Relationship search
  • Relationship filters
  • Relationship sorting
  • Eager loading
  • Relationship counts
  • Pagination
  • Collection output
  • Configurable query parameters

Installation

Install the package using Composer:

Terminal
composer require raprmdn/laravel-inertia-datatables

Publish the configuration file:

Terminal
php artisan vendor:publish --tag=inertia-datatables-config

Published file:

config/inertia-datatables.php

Basic Usage

Controller.php
use App\Models\User;
use Raprmdn\DataTables\Facades\DataTable;
 
$users = DataTable::query(User::query())
    ->searchable(['name', 'email'])
    ->orderBy('created_at', 'desc')
    ->make();

Example With Filters and Sorting

Controller.php
use Raprmdn\DataTables\Facades\DataTable;
 
$filterColumns = [
    'status'   => 'status',
    'priority' => 'priority.name',
];
 
[$columnFilters, $dateRanges] = DataTable::parseFilters(
    $request->query('filters', []),
    $filterColumns
);
 
$sortColumns = [
    'name'       => 'name',
    'email'      => 'email',
    'created_at' => 'created_at',
];
 
[$sort, $allowedSorts] = DataTable::parseSort(
    $request->query('col'),
    $sortColumns
);
 
$users = DataTable::query(User::query())
    ->searchable(['name', 'email'])
    ->applyFilters($columnFilters)
    ->allowedFilters(array_values($filterColumns))
    ->applySort($sort)
    ->allowedSorts($allowedSorts)
    ->orderBy('created_at', 'desc')
    ->make();

Why I Built It

Datatable logic is often repeated across Laravel controllers.

Most admin panels and internal tools need similar behavior: searching, filtering, sorting, pagination, and relationship-based columns. Instead of rewriting the same logic in every project, this package provides a reusable API for building backend-driven datatables.

Current Scope

The current beta version focuses on the Laravel backend query builder.

It can be used with:

  • Inertia
  • API resources
  • Blade
  • JSON responses
  • Custom Laravel responses

Frontend starter components are planned for a future release.

Tech Stack

Roadmap

  • Automated tests
  • Better documentation
  • More filter operators
  • Optional Inertia React starter components
  • Column definitions API