Laravel
Laravel Livewire vs Inertia: two approaches to a searchable dashboard
Compare Livewire and Inertia for a Laravel project dashboard, including query ownership, search, authorisation, validation and maintenance tradeoffs.
A searchable project dashboard is a useful way to compare Laravel frontend approaches. It needs more than an attractive table: users must see only their own projects, filters must work, and empty results must be understandable.
Livewire and Inertia are both options in Laravel’s official starter kits. Livewire centres the interface on PHP and Blade. Inertia connects Laravel routes and controllers to pages written with a JavaScript framework such as React or Vue. Neither choice removes the need for backend access control.
This is an implementation comparison, not a benchmark. The excerpts assume an authenticated Laravel application, an existing Project model with user_id and name columns, and the relevant frontend package already installed.
Agree on the dashboard’s behavior first
Use the same requirements in both versions:
- Show only the current user’s projects, newest first.
- Search project names and return at most twenty records for this small example.
- Preserve the search field while browsing results.
- Display a useful empty state.
- Authorise individual project actions separately.
For a larger catalogue, replace the fixed limit with pagination. Decide whether the filter should appear in the URL so people can bookmark or share it.
Livewire: keep search state beside the query
In a class-based Livewire component, the core behavior can look like this:
namespace App\Livewire;
use App\Models\Project;
use Livewire\Component;
class ProjectDashboard extends Component
{
public string $search = '';
public function render()
{
$search = mb_substr(trim($this->search), 0, 100);
return view('livewire.project-dashboard', [
'projects' => Project::query()
->where('user_id', auth()->id())
->when($search !== '', fn ($query) =>
$query->where('name', 'like', '%'.$search.'%'))
->latest('id')
->limit(20)
->get(['id', 'name']),
]);
}
}
In its Blade view:
<div>
<label for="project-search">Search projects</label>
<input id="project-search" type="search"
wire:model.live.debounce.300ms="search">
<p wire:loading>Updating projects…</p>
<ul>
@forelse ($projects as $project)
<li wire:key="project-{{ $project->id }}">
{{ $project->name }}
</li>
@empty
<li>No matching projects.</li>
@endforelse
</ul>
</div>
Mount the component behind authentication middleware. Treat public component properties as user input. The owner constraint belongs in every relevant query, even when the interface only displays records belonging to the user. Consult the Livewire component documentation for registration and project structure.
Inertia: send explicit page props from Laravel
An authenticated controller can return the same result set as props:
use App\Models\Project;
use Illuminate\Http\Request;
use Inertia\Inertia;
public function index(Request $request)
{
$validated = $request->validate([
'search' => ['nullable', 'string', 'max:100'],
]);
$search = trim($validated['search'] ?? '');
return Inertia::render('Projects/Index', [
'filters' => ['search' => $search],
'projects' => Project::query()
->where('user_id', $request->user()->id)
->when($search !== '', fn ($query) =>
$query->where('name', 'like', '%'.$search.'%'))
->latest('id')
->limit(20)
->get(['id', 'name']),
]);
}
A React page receiving those props can submit a search form:
import { router } from '@inertiajs/react';
import { useState } from 'react';
export default function Index({ projects, filters }) {
const [search, setSearch] = useState(filters.search);
function submit(event) {
event.preventDefault();
router.get('/projects', { search }, {
preserveState: true,
replace: true,
});
}
return <>
<form onSubmit={submit}>
<label htmlFor="project-search">Search projects</label>
<input id="project-search" type="search" maxLength={100}
value={search} onChange={e => setSearch(e.target.value)} />
<button type="submit">Search</button>
</form>
{projects.length === 0 ? <p>No matching projects.</p> :
<ul>{projects.map(project =>
<li key={project.id}>{project.name}</li>
)}</ul>}
</>;
}
This version submits explicitly, while the Livewire example updates after a debounce. That is a deliberate interaction choice, not an inherent framework limitation. For a production comparison, give both versions the same trigger and add loading and validation feedback. See Inertia’s page model for how props reach the frontend.
What changes for your team?
| Question | Livewire approach | Inertia approach |
|---|---|---|
| Where is interactive state expressed? | PHP component properties and Blade bindings | Frontend component state and page props |
| What frontend skills are central? | Blade, PHP and Livewire conventions | React, Vue or Svelte plus Laravel |
| Where does authorisation belong? | Server queries, policies and actions | Server queries, policies and controllers |
| What should tests observe? | Component behavior and public browser journeys | Controller responses and frontend browser journeys |
My recommendation: start with Livewire for a team already productive in Blade building forms and internal tools. Consider Inertia when a component-heavy frontend or existing React/Vue expertise is central to the project. Make the choice using a representative screen rather than a “hello world” example.
Before release, test access with a second account, long search terms, no matches and a slow connection. In this example % and _ keep SQL LIKE wildcard behavior; escape them if literal matching is a requirement. Parameter binding does not decide search semantics for you.
If the app also needs automated ticket routing, read AI SDK vs direct API calls. For an existing application, use the Laravel 13 upgrade checklist before changing framework versions.