© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•4mo ago•
9 replies
Breaking bad

How to debug in Filament

Hi guys need a little help ,

I have a custom resource to select which subjects are going to be taught in a class

So i created this checkbox field which loads options depending on which pattern/syllabus was selected

CheckboxList::make('subject_id')
                        ->relationship('subjects', 'name')
                        ->label('Subjects')
                        ->options(function (callable $get) {
                            $patternId = $get('pattern_id');
                            if (!$patternId) return [];
                            return Subject::query()
                                ->where('pattern_id', $patternId)
                                ->pluck('name', 'id');
                        })
                        ->columns(2)
                        ->disabled(fn($record) => filled($record))
                        ->dehydrated(false) // persisted in Pages using afterCreate/afterSave
                        ->helperText('Selections are saved as StudentClassSubjectMapping rows.')
CheckboxList::make('subject_id')
                        ->relationship('subjects', 'name')
                        ->label('Subjects')
                        ->options(function (callable $get) {
                            $patternId = $get('pattern_id');
                            if (!$patternId) return [];
                            return Subject::query()
                                ->where('pattern_id', $patternId)
                                ->pluck('name', 'id');
                        })
                        ->columns(2)
                        ->disabled(fn($record) => filled($record))
                        ->dehydrated(false) // persisted in Pages using afterCreate/afterSave
                        ->helperText('Selections are saved as StudentClassSubjectMapping rows.')




But apparently it is not saving the subjects in the pivot table ! I cannot get over it, please send boys.

Also my model relations are like

StudentClass Model

//fillables ...

  //relations
    public function subjects()
    {
        return $this->belongsToMany(
            \App\Models\Subject::class,
            'student_class_subject_mappings', // pivot table
            'student_class_id',               // FK to this model
            'subject_id'                      // FK to subjects
        )->withTimestamps();                  // remove if your pivot doesn't have timestamps
    } 
//fillables ...

  //relations
    public function subjects()
    {
        return $this->belongsToMany(
            \App\Models\Subject::class,
            'student_class_subject_mappings', // pivot table
            'student_class_id',               // FK to this model
            'subject_id'                      // FK to subjects
        )->withTimestamps();                  // remove if your pivot doesn't have timestamps
    } 
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to sum in filament
FilamentFFilament / ❓┊help
3y ago
How to filament table in filament form in v3?
FilamentFFilament / ❓┊help
3y ago
How to get current tenant in FilamentServiceProvider?
FilamentFFilament / ❓┊help
12mo ago
How to use Alpine in Filament?
FilamentFFilament / ❓┊help
13mo ago