F
Filament15mo ago
Mostafa

select filter with belongsToMany

im get error when selectfilter in table belongsToManyRelation. this code worked in filament version2!! SQLSTATE[42883]: Undefined function: 7 ERROR: could not identify an equality operator for type json LINE 1: select distinct "gen_constants".* from "gen_constants" left ... ^ SELECT DISTINCT "gen_constants".* FROM "gen_constants" LEFT JOIN "inf_learn_box_sections" ON "gen_constants"."id" = "inf_learn_box_sections"."section_id" WHERE "parent_id" = -1000 ORDER BY "gen_constants"."name" ASC -------------- this filter:: SelectFilter::make('sections') ->label('categoryFilter') ->relationship('sections', 'name' , function (Builder $query){ $query->where('parent_id', Constants::MainCategory); })
3 Replies
Mostafa
MostafaOP14mo ago
SQLSTATE[42883]: Undefined function: 7 ERROR: could not identify an equality operator for type json LINE 1: select distinct "blg_categories".* from "blg_categories" lef... ^ SELECT DISTINCT "blg_categories".* FROM "blg_categories" LEFT JOIN "blg_posts_categories" ON "blg_categories"."id" = "blg_posts_categories"."category_id" ORDER BY "blgcategories"."title" ASC Select::make('tags')->label('tags label') ->relationship('tags', 'title') ->multiple() ->preload(), This error is in the form
awcodes
awcodes14mo ago
What is the value of Constants::MainCategory? Also, are you using Postgres? That error returns a lot of google results, but it looks like it’s a common thing in Postgres.
Mostafa
MostafaOP14mo ago
I use postgress. I noticed the error. Column data type to use belongsToMany should use jsonb instead of json Thank you for your comment 🙌
Want results from more Discord servers?
Add your server