F
Filament2mo ago
NolanN

Can I show records from 2 relationship in one relation manager?

I have a Source model that has fields and definition relationships. The definition relationship also has a fields relationship. The Source model can return a list of validation rules that are generated by get the fields from the definition and then overrides any rules that have a title that match a field related to the Source. What I want is to have a relation manager on the SourceResource that can show all the fields related to the definition in a disabled state and the fields related to the Source in an enabled state. Is this possible to in a relation manager? Do I need to create a custom page possibly?
Solution:
I think I've got it after all. I created a definitionFields relationship like this: ``` public function definitionFields() { return $this->definition->fields();...
Jump to solution
2 Replies
NolanN
NolanN2mo ago
I thought about just adding another relation manager and grouping them but the Source::definition() relationship is a belongsTo so trying to access the fields with a hasManyThrough is not working
Solution
NolanN
NolanN2mo ago
I think I've got it after all. I created a definitionFields relationship like this:
public function definitionFields()
{
return $this->definition->fields();
}
public function definitionFields()
{
return $this->definition->fields();
}