0
这是我的代码:变量函数无法识别,laravel
public function userprofile($id)
{
$users = DB::table('users')->where('username', $id)->get();
$myposts = DB::table('posts')->where('maker', $id)->get();
$user_id = $id;
$postsvotes = DB::table('posts')
->join('upvotes', function($join)
{
$join->on('post_id', '=', 'upvotes.post_id')
->where('upvotes.user_id', $user_id);
})
->get();
return View::make('users.profile')->with('users', $users)->with('myposts', $myposts)->with('myvotes', $postsvotes);
}
我的工作一加入,因为你可以在看,我有这个变量$ user_ID的,这应该是$ ID你从函数userprofile($ id)得到一个参数,但我似乎无法将该参数放入where子句中。
问候,