Laravel Query Builder获取多个表

时间:2016-07-10 06:21:35

标签: laravel

<a>

如何在laravel查询构建器中执行相同的操作?

1 个答案:

答案 0 :(得分:0)

您可以尝试这样:

$name = $_POST['name'];
$where[] = ['authors.name ', $name];
$data = \DB::table('authors')
    ->join('quotes', 'quotes.author_id', '=', 'authors.id')
    ->where($where)
    ->get();