© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
ngoquocdat

Custom query in EditRecord

Hi guys,

How to custom the query in EditRecord?

I want to count the relastionship

My code:

 Section::make()
                    ->schema([
                        Placeholder::make('courses_count')
                            ->label(__('Total Courses'))
                            ->content(fn (CourseCategory $record): ?string => $record->courses_count),
                        Placeholder::make('created_at')
                            ->label('Created at')
                            ->content(fn (CourseCategory $record): ?string => $record->created_at?->diffForHumans()),

                        Placeholder::make('updated_at')
                            ->label('Last modified at')
                            ->content(fn (CourseCategory $record): ?string => $record->updated_at?->diffForHumans()),
                    ])
                    ->columnSpan(['lg' => 1])
                    ->hidden(fn (?CourseCategory $record) => $record === null),
 Section::make()
                    ->schema([
                        Placeholder::make('courses_count')
                            ->label(__('Total Courses'))
                            ->content(fn (CourseCategory $record): ?string => $record->courses_count),
                        Placeholder::make('created_at')
                            ->label('Created at')
                            ->content(fn (CourseCategory $record): ?string => $record->created_at?->diffForHumans()),

                        Placeholder::make('updated_at')
                            ->label('Last modified at')
                            ->content(fn (CourseCategory $record): ?string => $record->updated_at?->diffForHumans()),
                    ])
                    ->columnSpan(['lg' => 1])
                    ->hidden(fn (?CourseCategory $record) => $record === null),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Disable editRecord in custom view column
FilamentFFilament / ❓┊help
3y ago
Custom action before EditRecord
FilamentFFilament / ❓┊help
2y ago
Custom query in summaries
FilamentFFilament / ❓┊help
3y ago
Nested/indirect relationship in EditRecord
FilamentFFilament / ❓┊help
3y ago