Skip to content

Commit

Permalink
Add getScoutKeyName method to Scout docs
Browse files Browse the repository at this point in the history
  • Loading branch information
delenamalan authored Nov 1, 2019
1 parent 12bdfe4 commit 5cd4cd2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scout.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ By default, the entire `toArray` form of a given model will be persisted to its
<a name="configuring-the-model-id"></a>
### Configuring The Model ID

By default, Scout will use the primary key of the model as the unique ID stored in the search index. If you need to customize this behavior, you may override the `getScoutKey` method on the model:
By default, Scout will use the primary key of the model as the unique ID stored in the search index. If you need to customize this behavior, you may override the `getScoutKey` and the `getScoutKeyName` methods on the model:

<?php

Expand All @@ -159,6 +159,16 @@ By default, Scout will use the primary key of the model as the unique ID stored
{
return $this->email;
}
/**
* Get the key name used to index the model.
*
* @return mixed
*/
public function getScoutKeyName()
{
return 'email';
}
}

<a name="indexing"></a>
Expand Down

0 comments on commit 5cd4cd2

Please sign in to comment.