Table 1 has id uname
Table 2 has uid, but no uname,
Required to find out Table 1.id = Table 2.uid and output the uname of Table 1, and paginate the results
The general syntax is similar to User::hasOneRecord()::pagination(12)
do you know?
Table 1 has id uname
Table 2 has uid, but no uname,
Required to find out Table 1.id = Table 2.uid and output the uname of Table 1, and paginate the results
The general syntax is similar to User::hasOneRecord()::pagination(12)
do you know?
$result = DB::table('表1') ->join('表2', '表1.id', '=', '表2.uid') ->select('表1.uname') ->paginate(12);
OR
$result = table1::leftJoin('table2', 'table1.id', '=', 'table2.uid')->select('table1.uname')->paginate(12);