Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rohitnishad613's avatar

Use External API with Datatable

I am new to laravel. IDK why but everyone on the internet is teaching how to build data tables from the Database model. But I think another widespread use case is External APIs, in my case I call an API from livewire's controller. API return an Array.

How can I put this data into a beautiful user-friendly data table? I want to use Filament Table (Because I think it has the most beautiful user interface out-of-box.)

According to their docs, they expect an Eloquent Builder.

protected function getTableQuery(): Builder 
{
        return $this->keywordData;
} 

As expected this throws an error.

TypeError
App\Http\Livewire\COMONENTNAME::getTableQuery(): Return value must be of type Illuminate\Database\Eloquent\Builder, array returned (View: C:\PROJECTPATH\resources\views\livewire\COMONENTNAME.blade.php)
0 likes
1 reply

Please or to participate in this conversation.