File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,38 @@ public function query()
8383 return $ this ->query ;
8484 }
8585
86+ /**
87+ * Get the actual searchable column of the given column key.
88+ *
89+ * @param string $columnKey
90+ * @return string|mixed
91+ */
92+ public function getColumn ($ columnKey )
93+ {
94+ $ columns = $ this ->searchable ();
95+
96+ if (array_key_exists ($ columnKey , $ columns )) {
97+ return $ columns [$ columnKey ];
98+ }
99+
100+ foreach ($ columns as $ column ) {
101+ if ($ column === $ columnKey || ends_with ($ column , ". {$ columnKey }" )) {
102+ return $ column ;
103+ }
104+ }
105+ }
106+
107+ /**
108+ * Getter for searchable column.
109+ *
110+ * @param string $columnKey
111+ * @return string|mixed
112+ */
113+ public function __get ($ columnKey )
114+ {
115+ return $ this ->getColumn ($ columnKey );
116+ }
117+
86118 /**
87119 * Apply search query.
88120 *
Original file line number Diff line number Diff line change 66use Illuminate \Support \Facades \Schema ;
77
88/**
9- * Deprecated. Use SublimeSearch instead
9+ * Deprecated. Use SublimeSearch instead.
1010 */
1111class SearchableModel extends BaseGridQuery
1212{
You can’t perform that action at this time.
0 commit comments