My problem with getting the commenter is that I save the user Id when it comments and I return all comments below the post, but when I try to return the username as well, Laravel gives an error, I guess it is becouse it doesn't know for which user id it should return the username from users table. Currently the controller for comments is as following:
$comments = DB::select("Select * from comments where article_id = $articleID");
I get the $articleID
vie the route in orther to find the article content from database and I use it in comments table as well to find the comments that belong to the the specific article. But when I try to for example
$commenter = User::where('id', $comments->user_id)->first();
it fails. I tried a few version of this type SQL commands but does not work. Because it doesn't know which commenter I'm talking about (I guess). Do you have any idea about how I can do it?