Laravel嵌套关系where子句

时间:2015-10-23 22:03:48

标签: laravel nested eloquent relationships with-statement

如何在嵌套关系上设置where子句。 见下面的代码

    $row = $request->input('row');
    $col = $request->input('col');

    $name = 'r' . $row . 'c' . $col;
    $pageId = 1;

    $slot = TemplateSlot::where('name', '=', $name)
        ->with('pageslots.moduleslot.module')
        ->first();

我想要像

这样的东西
        $slot = TemplateSlot::where('name', '=', $name)
        ->with('pageslots.moduleslot.module')
        ->where('page_id', '=', $pageId)
        ->first();

Page_slots作为需要匹配的列page_id。

我尝试过类似:Laravel Eloquent Filter By Column of Relationship

的内容

0 个答案:

没有答案
相关问题