Eager load issue

I have a relation manager with eager load, i am using dot notation for the values, for some reason the data in a table shows in one row, instead of having a new row for each related data. Any help?
public function table(Table $table): Table
{
return $table
->emptyStateHeading('No Subscriptions Found')
->modifyQueryUsing(fn(Builder $query) => $query->whereHas('subscriptions'))
->columns([
Tables\Columns\TextColumn::make('subscriptions.stripe_id')
->label('Subscribe ID')
->badge()
->copyable(),
])
->filters([
//
])
->headerActions([
//Tables\Actions\CreateAction::make(),
]);
}
public function table(Table $table): Table
{
return $table
->emptyStateHeading('No Subscriptions Found')
->modifyQueryUsing(fn(Builder $query) => $query->whereHas('subscriptions'))
->columns([
Tables\Columns\TextColumn::make('subscriptions.stripe_id')
->label('Subscribe ID')
->badge()
->copyable(),
])
->filters([
//
])
->headerActions([
//Tables\Actions\CreateAction::make(),
]);
}
No description
Solution:
What you want is probably a left join to actually get multiple rows instead of eager loading a relation ship (which gives you a collection on every row)
Jump to solution
5 Replies
kingtox
kingtox3mo ago
bump
Dennis Koch
Dennis Koch3mo ago
Uhm. It’s a „column“ so it shows your values in one column. That’s how it’s intended. If you want to show different data you need to adjust the query.
kingtox
kingtox3mo ago
i want to show array data in each single row, right now it shows everything in one row. so adjusting query will resolve the issue? if so could you please share some more information?
Solution
Dennis Koch
Dennis Koch3mo ago
What you want is probably a left join to actually get multiple rows instead of eager loading a relation ship (which gives you a collection on every row)
kingtox
kingtox3mo ago
Perfect, let me try left join Thank you so much, left join resolve the issue.
Want results from more Discord servers?
Add your server
More Posts
Routes not showing in NavigationHey - **Beginner** issue here. Having a problem with auth routes/navigation not filling out. When I How can I place a text beneath the image in table column?I want to write username beneath the avatar in an `ImageColumn` in table. I tried to use `->descriptTesting and requiresConfirmationI have a RM with a table row action, that row action launches a modal with an approval action. I canCustom view OTP input not working(no js execution)?I'm trying to add the following tailwind otp input into a custom page view but the javascript part iHow to have HTML content inside tooltipI have requirement to have a html table with a tooltip when you hover over a table column cell, i haPseudo multi tenant setup using panels w/ a parameter (or maybe something else?)Heya everyone! I'm in the process of upgrading from Filament v2, but I have a non standard setup andHow to close action confirmation modal after form validate fails?I have a custom livewire component that has a form with rules and submit action. ```public functioSpatie Translatable plugin: Possible to have persistent LocaleSwitcher?Is it possible to have the LocaleSwitcher be persistent when navigating through List and Edit ResourFor IconColumn, only show boolean icon when true?Hi there, I have an icon column (see screenshot) but I only want an icon to display when the value iGet current value of table filterI am trying to filter the results of a SelectFilter based on the boolean value of another TableFilte