I already looked at this post but I can't seem to make it right:
I get this error:
https://gyazo.com/2ea7b7bb6a19d588829447ee1a92053e I use laravel 5.2 for this.
some screenshots:
https://gyazo.com/1b2c35e660dfe1aae69a02703733d083 https://gyazo.com/3d6f294473f6e54650a4a4403dc2777e https://gyazo.com/a59aebc7362f51f9ac27852ea032f962
Asked
Active
Viewed 90 times
-1
-
This would be so much easier if you pasted the code rather than screenshotting it :D Anyway, your problem is in your `join` statement. Try specifiying table in the `where` methods. Like this: `User::where('users.id', $id)->leftJoin('user_details', 'user_details.user_id', '=', 'users.id')->first()` – DevK Feb 03 '17 at 09:53
-
Oops i forgot man It was a post. – TheBAST Feb 03 '17 at 10:17
-
Please don't paste code as images. External images makes this worse because when these external resources weren't available anymore the question is useless. Please correct this - otherwise it is likely that this question is closed. – gus27 Feb 03 '17 at 10:26
1 Answers
0
To expand on my comment:
Your problem is here:
$user = User::where('id', $id) // Here more specifically, Laravel does not know if you mean id of users table or details table
->leftJoin('user_details', user_details.user_id', '=', 'users.id')
->first();
Rewrite your where
statement like this:
$user = User::where('users.id', $id)....
And it should work. Basically since you're joining 2 tables and they both got id
you need to specify which id
you want to query by.

DevK
- 9,597
- 2
- 26
- 48