From faa6a750745a366628d4c2d1eb78ea18daab11bd Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Sun, 25 Sep 2022 14:06:12 +0200 Subject: [PATCH] SearchControls: Provide base implementation for `fetchFilterColumns()` ipl-orm's column definitions are now "mature" enough for me to do this --- src/Compat/SearchControls.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Compat/SearchControls.php b/src/Compat/SearchControls.php index c40204d7..4621776b 100644 --- a/src/Compat/SearchControls.php +++ b/src/Compat/SearchControls.php @@ -21,7 +21,15 @@ trait SearchControls * * @return array Keys are column paths, values are labels */ - abstract public function fetchFilterColumns(Query $query); + public function fetchFilterColumns(Query $query) + { + $columns = []; + foreach ($query->getResolver()->getColumnDefinitions($query->getModel()) as $name => $definition) { + $columns[$name] = $definition->getLabel(); + } + + return $columns; + } /** * Get whether {@see SearchControls::createSearchBar()} and {@see SearchControls::createSearchEditor()}