0

How can i set a where clause on a nested relationship. See code below

    $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();

i want something like

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

Page_slots as a column page_id that needs to match.

I tried something like: Laravel Eloquent Filter By Column of Relationship

Community
  • 1
  • 1

0 Answers0