Link Routing
Link columns need to resolve Laravel route names into URLs. Inertia Table supports two strategies: client-side resolution via Ziggy or server-side resolution via Laravel's route() helper.
Ziggy (Default)
By default, route names and parameters are sent to the frontend, and Ziggy resolves them into URLs client-side.
// PHP - sends route name + params to frontend
Column::make('name', 'Name')
->link('companies.show', ['company' => ':id']);The frontend receives { route: 'companies.show', params: { company: ':id' } } and calls window.route() (provided by Ziggy) to build the URL.
Setup
Install Ziggy in your Laravel project:
composer require tightenco/ziggyAdd the @routes Blade directive to your app layout:
<head>
@routes
@viteReactRefresh
@vite(['resources/js/app.tsx'])
</head>Install the JS package:
npm install ziggy-jsThis is the recommended approach for most projects, as it keeps your route definitions in sync between PHP and JavaScript.
Server-Side Resolution
If your project does not use Ziggy, you can resolve routes on the server instead. Set use_ziggy to false in your config:
// config/inertia-table.php
return [
'use_ziggy' => false,
// ...
];With this setting, Column::link() resolves URLs server-side using Laravel's route() helper. The frontend receives pre-built URLs directly - no Ziggy required.
// Same PHP code - behavior changes based on config
Column::make('name', 'Name')
->link('companies.show', ['company' => ':id']);The :id token is replaced with each row's id value on the server. The frontend receives the fully resolved URL (e.g., /companies/5) instead of a route name.
How It Works
When use_ziggy is false:
- The route is resolved per-row during response building
- Token parameters (
:field) are substituted using the model's data viadata_get() - The resolved URL is included in the row data
- The frontend renders the link directly without needing Ziggy
This means nested accessors work too:
Column::make('name', 'Name')
->link('users.show', ['user' => ':owner.id']);Trade-offs
| Ziggy (default) | Server-Side | |
|---|---|---|
| Route resolution | Client-side | Server-side |
| Requires Ziggy | Yes | No |
| Payload | Route name + params | Pre-built URLs |
| Route changes | Reflected immediately via Ziggy | Reflected on next server response |
| Performance | Single route manifest load | route() call per link per row |
For most projects, the performance difference is negligible. Laravel's route() uses a cached route collection internally.
LinkColumn
LinkColumn is a convenience class that delegates to Column::link(). It respects the use_ziggy config automatically:
use Forjed\InertiaTable\Columns\LinkColumn;
LinkColumn::make('name', 'Name')
->route('companies.show', ['company' => ':id']);See Column Types for more details.