{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/searchindex/issues/12","labels_url":"https://api.github.com/repos/spatie/searchindex/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/spatie/searchindex/issues/12/comments","events_url":"https://api.github.com/repos/spatie/searchindex/issues/12/events","html_url":"https://github.com/spatie/searchindex/issues/12","id":111543416,"number":12,"title":"Model is not recognized as Searchable object","user":{"login":"foxlance","id":914792,"avatar_url":"https://avatars.githubusercontent.com/u/914792?v=3","gravatar_id":"","url":"https://api.github.com/users/foxlance","html_url":"https://github.com/foxlance","followers_url":"https://api.github.com/users/foxlance/followers","following_url":"https://api.github.com/users/foxlance/following{/other_user}","gists_url":"https://api.github.com/users/foxlance/gists{/gist_id}","starred_url":"https://api.github.com/users/foxlance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxlance/subscriptions","organizations_url":"https://api.github.com/users/foxlance/orgs","repos_url":"https://api.github.com/users/foxlance/repos","events_url":"https://api.github.com/users/foxlance/events{/privacy}","received_events_url":"https://api.github.com/users/foxlance/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-15T04:34:02Z","updated_at":"2015-10-15T16:41:26Z","closed_at":null,"body":"I followed the instructions closely and encountered a problem by the time I reach the part where I get to use to upsertToIndex().\r\n\r\nI'm using Laravel 5.1 for this example. I have the Searchable interface saved at app\\Spatie\\SearchIndex\\Searchable.php. My Model is as follows:\r\n\r\n```php\r\n<?php\r\n \r\nnamespace App;\r\n \r\nuse App\\Spatie\\SearchIndex\\Searchable;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n \r\nclass Post extends Model implements Searchable\r\n{\r\n    public $fillable = ['title', 'content', 'tags'];\r\n \r\n    /**\r\n     * Returns an array with properties which must be indexed\r\n     *\r\n     * @return array\r\n     */\r\n    public function getSearchableBody()\r\n    {\r\n        $searchableProperties = [\r\n            'title' => $this->title,\r\n            'content' => $this->content\r\n        ];\r\n \r\n        return $searchableProperties;\r\n    }\r\n \r\n    /**\r\n     * Return the type of the searchable subject\r\n     *\r\n     * @return string\r\n     */\r\n    public function getSearchableType()\r\n    {\r\n        return 'post';\r\n    }\r\n \r\n    /**\r\n     * Return the id of the searchable subject\r\n     *\r\n     * @return string\r\n     */\r\n    public function getSearchableId()\r\n    {\r\n        return $this->id;\r\n    }\r\n}\r\n```\r\nMy Controller as follows:\r\n\r\n```php\r\nclass Posts extends Controller\r\n{\r\n    public function index()\r\n    {\r\n        $post = Post::first();\r\n \r\n        \\SearchIndex::upsertToIndex($post);\r\n    }\r\n}\r\n```\r\n\r\nI'm getting the error:\r\n```\r\nArgument 1 passed to Spatie\\SearchIndex\\SearchIndexHandlers\\Elasticsearch::upsertToIndex() must be an instance of Spatie\\SearchIndex\\Searchable, instance of App\\Post given, called in /home/vagrant/Code/laravel51/bootstrap/cache/compiled.php on line 5964 and defined\r\n```\r\nI'm pretty sure I've implemented the interface properly, as removing any of these methods will throw an error reminding to implement the interface properly. The only difference from your README is that the example code uses \"Eloquent\" instead of \"Model\"."},"comment":{"url":"https://api.github.com/repos/spatie/searchindex/issues/comments/148449813","html_url":"https://github.com/spatie/searchindex/issues/12#issuecomment-148449813","issue_url":"https://api.github.com/repos/spatie/searchindex/issues/12","id":148449813,"user":{"login":"foxlance","id":914792,"avatar_url":"https://avatars.githubusercontent.com/u/914792?v=3","gravatar_id":"","url":"https://api.github.com/users/foxlance","html_url":"https://github.com/foxlance","followers_url":"https://api.github.com/users/foxlance/followers","following_url":"https://api.github.com/users/foxlance/following{/other_user}","gists_url":"https://api.github.com/users/foxlance/gists{/gist_id}","starred_url":"https://api.github.com/users/foxlance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxlance/subscriptions","organizations_url":"https://api.github.com/users/foxlance/orgs","repos_url":"https://api.github.com/users/foxlance/repos","events_url":"https://api.github.com/users/foxlance/events{/privacy}","received_events_url":"https://api.github.com/users/foxlance/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T16:41:26Z","updated_at":"2015-10-15T16:41:26Z","body":"Thanks Freek, that was all there is to it!"}}