how render a table inside a tab?

hi i would like to load a table inside a tab like image attached, but that table should lookup info depending on the selected user id. i know i need to create a livewire custom component, but any idea to follow? and also another question how i call that livewire component inside lets say Tab #2. any tip appreciate it. thank you
No description
Solution:
\Filament\Forms\Components\Livewire::make(\App\Livewire\ClientesFacturas::class)
\Filament\Forms\Components\Livewire::make(\App\Livewire\ClientesFacturas::class)
...
Jump to solution
23 Replies
LeandroFerreira
LeandroFerreira2mo ago
1 - Create a LW component and add the table: https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component 2 - Insert the LW component
...
return $form
->schema([
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Tab1')
->schema([
Livewire::make(YourCustomTable::class)
])
])
...
return $form
->schema([
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Tab1')
->schema([
Livewire::make(YourCustomTable::class)
])
])
agaitan026
agaitan026OP2mo ago
thank you, im getting this Class "App\Filament\Resources\Livewire" not found
krekas
krekas2mo ago
import livewire namespace
agaitan026
agaitan026OP2mo ago
how? im already using namespace App\Filament\Resources; inside namespace App\Filament\Resources; namespace App\Livewire; if i put this i got error
Firebat
Firebat2mo ago
you could create a relation manager and then
Firebat
Firebat2mo ago
unless you want to use the table shown on the image
agaitan026
agaitan026OP2mo ago
yes should be almost the same, the idea is for me to see invoices from that selected client without going to another menu item
Firebat
Firebat2mo ago
then that example would work if you have declared on the model the relations correctly
agaitan026
agaitan026OP2mo ago
and why not the custom lw component?
Firebat
Firebat2mo ago
well you can always go with the custom, i just thought that if you are building a fillament app you would want to use already built tools
LeandroFerreira
LeandroFerreira2mo ago
\Filament\Forms\Components\Livewire::make(YourCustomTable::class) actually
agaitan026
agaitan026OP2mo ago
and how i put that relation inside a tab? Tabs\Tab::make('Tab 2') ->schema([ \Filament\Forms\Components\Livewire::make(ClientesFacturas::class) ]), like this?
Firebat
Firebat2mo ago
do you know how the relation manager works? if you dont it uses the model relation like HasMany, HasOne, BelongsTo and others and then it returns the table of relations
LeandroFerreira
LeandroFerreira2mo ago
yep
Firebat
Firebat2mo ago
here, it will explain better than me
agaitan026
agaitan026OP2mo ago
Unable to find component: [App\Filament\Resources\ClientesFacturas] i got my class inside app/filament/livewire/ ty. will try both ways to see which fits in my case, thank you
LeandroFerreira
LeandroFerreira2mo ago
Did you create this LW component ClientesFacturas?
agaitan026
agaitan026OP2mo ago
yes
No description
Solution
LeandroFerreira
LeandroFerreira2mo ago
\Filament\Forms\Components\Livewire::make(\App\Livewire\ClientesFacturas::class)
\Filament\Forms\Components\Livewire::make(\App\Livewire\ClientesFacturas::class)
agaitan026
agaitan026OP2mo ago
works good thank you so much
krekas
krekas2mo ago
Maybe do some research about namespaces
Want results from more Discord servers?
Add your server