related select filters

How do I create a related select filters? I want to display the chapters related only to the course
->filters([
Tables\Filters\SelectFilter::make('course_id')
->relationship('course', 'name')
->selectablePlaceholder(false)
->label('Course')
->preload(),
Tables\Filters\SelectFilter::make('chapter_id')
->relationship(
'chapter',
'name',
function(Builder $query, Get $get) {
info($get('../course_id'));
$query->where('course_id', $get('course_id'));
}
),
], layout: FiltersLayout::AboveContent)
->filters([
Tables\Filters\SelectFilter::make('course_id')
->relationship('course', 'name')
->selectablePlaceholder(false)
->label('Course')
->preload(),
Tables\Filters\SelectFilter::make('chapter_id')
->relationship(
'chapter',
'name',
function(Builder $query, Get $get) {
info($get('../course_id'));
$query->where('course_id', $get('course_id'));
}
),
], layout: FiltersLayout::AboveContent)
1 Reply
Solution
Want results from more Discord servers?
Add your server