Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit 506cff6

Browse files
authored
Merge pull request #48 from YABhq/develop
Develop
2 parents 4a9d1f2 + a3882a0 commit 506cff6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Services/ModelService.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,17 @@ public function getFullTextIndexFields()
4040
foreach ($searchableFields as $searchableField) {
4141

4242
//@TODO cache this.
43-
$columnType = DB::connection($this->connectionName)->
44-
select("SHOW FIELDS FROM $this->tableName where Field = ?", [$searchableField])[0]->Type;
43+
$sql = "SHOW FIELDS FROM $this->tableName where Field = ?";
44+
$column = DB::connection($this->connectionName)->select($sql, [$searchableField]);
4545

46+
if (!isset($column[0])) {
47+
continue;
48+
}
49+
50+
$columnType = $column[0]->Type;
51+
52+
// When using `$appends` to include an accessor for a field that doesn't exist,
53+
// an ErrorException will be thrown for `Undefined Offset: 0`
4654
if ($this->isFullTextSupportedColumnType($columnType)) {
4755
$indexFields[] = $searchableField;
4856
}

0 commit comments

Comments
 (0)