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
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
agaitan026OP3w ago
thank you, im getting this Class "App\Filament\Resources\Livewire" not found
krekas
krekas3w ago
import livewire namespace
agaitan026
agaitan026OP3w 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
Firebat3w ago
you could create a relation manager and then
Firebat
Firebat3w ago
unless you want to use the table shown on the image
agaitan026
agaitan026OP3w 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
Firebat3w ago
then that example would work if you have declared on the model the relations correctly
agaitan026
agaitan026OP3w ago
and why not the custom lw component?
Firebat
Firebat3w 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
\Filament\Forms\Components\Livewire::make(YourCustomTable::class) actually
agaitan026
agaitan026OP3w 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
Firebat3w 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
yep
Firebat
Firebat3w ago
here, it will explain better than me
agaitan026
agaitan026OP3w 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
Did you create this LW component ClientesFacturas?
agaitan026
agaitan026OP3w ago
yes
No description
Solution
LeandroFerreira
\Filament\Forms\Components\Livewire::make(\App\Livewire\ClientesFacturas::class)
\Filament\Forms\Components\Livewire::make(\App\Livewire\ClientesFacturas::class)
agaitan026
agaitan026OP3w ago
works good thank you so much
krekas
krekas3w ago
Maybe do some research about namespaces
Want results from more Discord servers?
Add your server