Oct 5, 2024
0
Level 1
Filamentphp Filter
->filters([ SelectFilter::make('school_id') ->label('School') ->options(School::pluck('name', 'id')) ->searchable(), //->preload()
SelectFilter::make('class_level_id')
->label('Level')
->options(function () {
// Get the selected school_id from the filters
$schoolId = request()->query('tableFilters')['school_id']['value'] ?? null;
Log::info('Selected School ID:', ['school_id' => $schoolId]);
// Return empty options if no school is selected
if (!$schoolId) {
return [];
}
// Return the class levels for the selected school
return ClassLevel::where('school_id', $schoolId)->pluck('name', 'id');
})
->searchable()
//->preload()
])
->filtersFormColumns(3) Filamentphp v3 why school_id is null ?
Please or to participate in this conversation.