Make sure that your table has a column named department_name and if it doesn't make sure that you enter the correct column name in your text column definition.
@Tray2 I am using accessors to fetch the record , the column department_name is not present in table, as iI am using relation to fetch the record , Filament need to filter the record on the relational data
@Tray2 Basically department_name is a virtual based column , used to fetch the record , I want to apply search on this virtual column , is there anyway , without inserting this column into the job_application table , by virtual column the search functionality works , if I make another column in database of department_name its not good approach as table alos have foreign key job_id.
public function getDepartmentNameAttribute()
{
return optional($this->job()->withTrashed()->first())->department->name ?? null;
}
@Tray2 No I didnt added virtual column in schema, if I need to add a column in database, then I would add it and set mutators and observers for the specific column ,but I was looking for how filament perform search on columns that are fetching record using eloquent relations.
E.g
I'm in Job_application table in this tabe I have job_id foreign key,
in Job table there is department_id
Now using accesor i fetch the department 'name' in job_application model now on department_name i want to apply search , but that column isnt physically present.
So how filament will going to perform search on this specific relation.
I've implemented one solution by adding column in database of department_name i can perform search but , its not good idea to insert record on multiple tables
@SYED_IRTAZA_HASNAIN True, it is not optimal, but you can always use a view instead of a table, then you solve that issue.
When I was playing around a little with filament, I did this to fetch the name of the relation item, and it seems similar to what you are trying to do.