调用未定义的方法Illuminate \ Database \ Query \ Builder :: join(“ branches”,“ branches.id”,“ users.branch_id”)-> get()

时间:2019-08-27 05:46:53

标签: laravel laravel-query-builder

$query = \DB::table("public.users")->join("branches",function($join){$join->on("branches.id", "=", "users.branch_id");})->get;

dd($query());
  

调用未定义的方法Illuminate \ Database \ Query \ Builder :: join(“ branches”,“ branches.id”,“ users.branch_id”)-> get()

大型展示查询结果

2 个答案:

答案 0 :(得分:0)

try to remove public from the query.
$query = \DB::table("users")->join("branches",function($join){$join- 
  

on(“ branches.id”,“ =”,“ users.branch_id”);})-> get;

答案 1 :(得分:0)

$query = DB::table('users')
            ->join('contacts', 'users.id', '=', 'contacts.user_id')
            ->get();