{"action":"created","issue":{"url":"https://api.github.com/repos/barryvdh/laravel-ide-helper/issues/259","labels_url":"https://api.github.com/repos/barryvdh/laravel-ide-helper/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/barryvdh/laravel-ide-helper/issues/259/comments","events_url":"https://api.github.com/repos/barryvdh/laravel-ide-helper/issues/259/events","html_url":"https://github.com/barryvdh/laravel-ide-helper/issues/259","id":103119447,"number":259,"title":"Should ide-helper:models be generating phpDoc for the magic Eloquent\\Model static methods?","user":{"login":"jessedc","id":17407,"avatar_url":"https://avatars.githubusercontent.com/u/17407?v=3","gravatar_id":"","url":"https://api.github.com/users/jessedc","html_url":"https://github.com/jessedc","followers_url":"https://api.github.com/users/jessedc/followers","following_url":"https://api.github.com/users/jessedc/following{/other_user}","gists_url":"https://api.github.com/users/jessedc/gists{/gist_id}","starred_url":"https://api.github.com/users/jessedc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessedc/subscriptions","organizations_url":"https://api.github.com/users/jessedc/orgs","repos_url":"https://api.github.com/users/jessedc/repos","events_url":"https://api.github.com/users/jessedc/events{/privacy}","received_events_url":"https://api.github.com/users/jessedc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-25T21:16:48Z","updated_at":"2015-09-01T07:22:00Z","closed_at":null,"body":"I have recently setup a new Lumen project (v5.1.3) and noticed the instance methods from `Eloquent\\Builder` provided to `Eloquent\\Model` by using `Model::__callStatic()` and `Model->__call()` internally are not added to the phpDocs generated by `ide-helper:models`.\r\n\r\nOne example directly from  [the Larvel 5.1 documentation](http://laravel.com/docs/5.1/eloquent#eloquent-model-conventions) is the `::find()` method.\r\n\r\n<img width=\"398\" alt=\"screen shot 2015-08-26 at 6 50 18 am\" src=\"https://cloud.githubusercontent.com/assets/17407/9479459/e09915e6-4bc0-11e5-9b45-786a0aaa9289.png\">\r\n\r\nMy observation is this call to ::find() is caught by `__callStatic()` and `__call()` methods of Eloquent\\Model and proxied to `\\Illuminate\\Database\\Eloquent\\Builder`.\r\n\r\n<img width=\"728\" alt=\"screen shot 2015-08-25 at 9 51 58 pm\" src=\"https://cloud.githubusercontent.com/assets/17407/9480110/74b2a636-4bc4-11e5-888e-c7efeb6be163.png\">\r\n\r\nThese methods can be added to the phpDocs of the model with @method hints like the following: \r\n\r\n```php\r\n/**\r\n* @method static \\Illuminate\\Database\\Eloquent\\Model|\\App\\Models\\Cafe find($id)\r\n*/\r\n```\r\n\r\nMy question is, **should these magic methods from Builder be added to Model subclasses by `ide-helper:models`**?  Or should the Laravel documentation be updated instead?\r\n\r\nWorth noting that this whole situation can also be avoided by using the builder directly via the `query()` method.\r\n\r\n```php\r\n$cafe = Cafe::query()->find($cafeId);\r\n```\r\n\r\n> The [find() method was defined in 5.0](http://laravel.com/api/5.0/Illuminate/Database/Eloquent/Model.html#method_find) but are no longer defined on the `Eloquent\\Model` as of 5.1."},"comment":{"url":"https://api.github.com/repos/barryvdh/laravel-ide-helper/issues/comments/136611731","html_url":"https://github.com/barryvdh/laravel-ide-helper/issues/259#issuecomment-136611731","issue_url":"https://api.github.com/repos/barryvdh/laravel-ide-helper/issues/259","id":136611731,"user":{"login":"bebnev","id":8371521,"avatar_url":"https://avatars.githubusercontent.com/u/8371521?v=3","gravatar_id":"","url":"https://api.github.com/users/bebnev","html_url":"https://github.com/bebnev","followers_url":"https://api.github.com/users/bebnev/followers","following_url":"https://api.github.com/users/bebnev/following{/other_user}","gists_url":"https://api.github.com/users/bebnev/gists{/gist_id}","starred_url":"https://api.github.com/users/bebnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bebnev/subscriptions","organizations_url":"https://api.github.com/users/bebnev/orgs","repos_url":"https://api.github.com/users/bebnev/repos","events_url":"https://api.github.com/users/bebnev/events{/privacy}","received_events_url":"https://api.github.com/users/bebnev/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T07:22:00Z","updated_at":"2015-09-01T07:22:00Z","body":"I think that having such methods in Model docblocks is a real overhead, because find is only one \"magic\" method from EloquentBuilder. Then somebody will want methods from the QueryBuilder which are also called with __call/__callStatic.\r\n\r\nSo the easiest workaround, if you need autocompletion, is to extend `Eloquent` instead of` Eloquent\\Model`, as @rentalhost said. Or, if you don't want to extend `Eloquent`, you can set something like this to the docblock of your model:\r\n```php\r\n/**\r\n * App\\User\r\n *\r\n * @mixin Eloquent\r\n */\r\n```"}}