Options with multiple condition.

Good evening, how to list an option from database with multiple condition ? At the moment im still using relationship and only have 1 condition.

                                Select::make('parent_id')
                                    ->label('Category')
                                    ->relationship('mainCategory', 'name', fn (Builder $query)
                                            =>$query->where('parent_id', '=', NULL))
                                    ->searchable()
                                    ->placeholder('Select parent category'),


What i want to achieve is, the option will only show category with parent_id is null and the status is active.
Solution
Just chain another where() clause on.
Was this page helpful?