Created
September 15, 2016 19:57
-
-
Save markbiek/2f5f85744a57f9cb2545065586783888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person extends Model { | |
| use AlgoliaEloquentTrait; | |
| public $indices = [‘my-index’]; | |
| public function getAlgoliaRecord() { | |
| return array_merge($this->toArray(), [ | |
| ‘addresses’ => $this->addresses->toArray(), | |
| ‘contacts’ => $this->contacts->toArray(), | |
| ‘type’ => ‘person' | |
| ]); | |
| } | |
| public function getKeyAttribute() { | |
| return “person_{$this->id}”; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment