Skip to content

Commit da58ba9

Browse files
MortenDHansenMorten D. Hansentaylorotwell
authored
[10.x] Optional field definitions on model (#812)
* Optional field definitions Check if field definitions has been added on the model and use if that is the case * Update TypesenseEngine.php * Update TypesenseEngine.php --------- Co-authored-by: Morten D. Hansen <mdh@eltwin.com> Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 8783042 commit da58ba9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Engines/TypesenseEngine.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,10 @@ protected function getOrCreateCollectionFromModel($model): TypesenseCollection
501501
} catch (ObjectNotFound $exception) {
502502
$schema = config('scout.typesense.model-settings.'.get_class($model).'.collection-schema') ?? [];
503503

504+
if (method_exists($model, 'typesenseCollectionSchema')) {
505+
$schema = $model->typesenseCollectionSchema();
506+
}
507+
504508
if (! isset($schema['name'])) {
505509
$schema['name'] = $model->searchableAs();
506510
}

0 commit comments

Comments
 (0)