{"action":"created","issue":{"url":"https://api.github.com/repos/fico7489/laravel-eloquent-join/issues/8","repository_url":"https://api.github.com/repos/fico7489/laravel-eloquent-join","labels_url":"https://api.github.com/repos/fico7489/laravel-eloquent-join/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/fico7489/laravel-eloquent-join/issues/8/comments","events_url":"https://api.github.com/repos/fico7489/laravel-eloquent-join/issues/8/events","html_url":"https://github.com/fico7489/laravel-eloquent-join/issues/8","id":299494174,"number":8,"title":"[BUG] whereJoin is using wrong column for SQL joining ","user":{"login":"delmicio","id":2908209,"avatar_url":"https://avatars1.githubusercontent.com/u/2908209?v=4","gravatar_id":"","url":"https://api.github.com/users/delmicio","html_url":"https://github.com/delmicio","followers_url":"https://api.github.com/users/delmicio/followers","following_url":"https://api.github.com/users/delmicio/following{/other_user}","gists_url":"https://api.github.com/users/delmicio/gists{/gist_id}","starred_url":"https://api.github.com/users/delmicio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delmicio/subscriptions","organizations_url":"https://api.github.com/users/delmicio/orgs","repos_url":"https://api.github.com/users/delmicio/repos","events_url":"https://api.github.com/users/delmicio/events{/privacy}","received_events_url":"https://api.github.com/users/delmicio/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-02-22T20:19:12Z","updated_at":"2018-02-27T15:37:48Z","closed_at":"2018-02-27T12:46:35Z","author_association":"NONE","body":"Hi, I've tried a simple query for testing a realation using whereJoin\r\n`App\\Models\\ZoomMeeting::whereJoin('live_class.id', '>', 0)->count()`\r\n\r\nBut it fails showing this:\r\n```\r\nIlluminate\\Database\\QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 \r\nUnknown column 'live_classes.live_class_id' in 'on clause' (SQL: select count(*) as aggregate from \r\n`zoom_meetings` left join `live_classes` on `live_classes`.`live_class_id` = `zoom_meetings`.`live_class_id` \r\nwhere `live_classes`.`id` > 0 group by `zoom_meetings`.`live_class_id`)'\r\n```\r\n\r\nThe problem is that is using **live_classes.live_class_id** for joining when it should be using **live_classes.id**\r\n\r\n```PHP\r\nclass ZoomMeeting extends Eloquent\r\n{\r\n    protected $primaryKey = 'live_class_id';\r\n    public $incrementing = false;\r\n\r\n    protected $casts = [\r\n        'live_class_id' => 'int'\r\n    ];\r\n\r\n    public function live_class()\r\n    {\r\n        return $this->belongsTo(\\App\\Models\\LiveClass::class);\r\n    }\r\n}\r\n\r\nclass LiveClass extends Eloquent\r\n{\r\n    public function zoom_meeting()\r\n    {\r\n        return $this->hasOne(\\App\\Models\\ZoomMeeting::class);\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/fico7489/laravel-eloquent-join/issues/comments/368919794","html_url":"https://github.com/fico7489/laravel-eloquent-join/issues/8#issuecomment-368919794","issue_url":"https://api.github.com/repos/fico7489/laravel-eloquent-join/issues/8","id":368919794,"user":{"login":"delmicio","id":2908209,"avatar_url":"https://avatars1.githubusercontent.com/u/2908209?v=4","gravatar_id":"","url":"https://api.github.com/users/delmicio","html_url":"https://github.com/delmicio","followers_url":"https://api.github.com/users/delmicio/followers","following_url":"https://api.github.com/users/delmicio/following{/other_user}","gists_url":"https://api.github.com/users/delmicio/gists{/gist_id}","starred_url":"https://api.github.com/users/delmicio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delmicio/subscriptions","organizations_url":"https://api.github.com/users/delmicio/orgs","repos_url":"https://api.github.com/users/delmicio/repos","events_url":"https://api.github.com/users/delmicio/events{/privacy}","received_events_url":"https://api.github.com/users/delmicio/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T15:37:48Z","updated_at":"2018-02-27T15:37:48Z","author_association":"NONE","body":"Hey @fico7489 this issue is still present, you should not close it.\r\nWere you able to reproduce it?"}}
{"actor":{"display_login":"delmicio"}}