Custom query in EditRecord
Hi guys,
How to custom the query in EditRecord?
I want to count the relastionship
My code:
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),