F
Filamentβ€’7mo ago
oks_voice123

Completely lost on relationship with table as livewire component

Hi all , I'm completely lost with the Table component as livewire component . Sorry to ask it like that but I'm newbie on this πŸ™‚ So I need to have a public page with a Table inside as the authentication is done via another software which is loading my public page within the application. I have eveything which is working fine under the Panel for the admin site . I have an User Model and a LineGroup Model ... There is a Many-to-Many relationship with a pivot table and extra-columns . When I'm using the RelationsManager within the admin panel . All relations are loaded perfectly and so on . Now my public page should retrieve the username from the URL ( hardcoded in the URL) but in my pivot table , the username is referring to its ID via the User Model and the LineGroup Model . When I'm reading this --> https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component#:~:text=%23-,Building%20a%20table%20for%20an%20Eloquent%20relationship,-If%20you%20want . It seems that it is what I need . But in every case , I have no clues how I can populate my data for the table or how can I access my pivot table ? Can you point me in which direction I need to go ? Sorry but this is something completely new for me Many thanks
Solution:
Just build a livewire component which has a table, which adds a param. Then in the blade of the custom page, render the livewire component all as per the livewire docs πŸ™‚
Jump to solution
5 Replies
toeknee
toekneeβ€’7mo ago
The table can only be populated with Eloquent data, you can use sushi and make a relationship from your user model, to a sushi model which fetches the data from wherever you want
oks_voice123
oks_voice123OPβ€’7mo ago
all datas were available in my Eloquent Data so with sushi I will add then an extra layer even if my relation is working fine and already available from the relationManager when I'm logging in the Admin Panel the fact is that I can show all informations in my table but I can't filter on the user
toeknee
toekneeβ€’7mo ago
If it works on the admin panel... it'll work on the livewire component, the only different is you won't have a lower relationship manager. You can always have multiple tables, and have thesecond table be a livewire component that passes in this records id to get the data.
oks_voice123
oks_voice123OPβ€’7mo ago
yes my big deal is to understand how I can do that πŸ™‚
Solution
toeknee
toekneeβ€’7mo ago
Just build a livewire component which has a table, which adds a param. Then in the blade of the custom page, render the livewire component all as per the livewire docs πŸ™‚
Want results from more Discord servers?
Add your server