Journal Entry, February 7th to February 14th 2020

February 14, 2020 · 1 min read

Laravel

  1. Thu Feb 13

    • Query a group of records based on parameters deep in a parent relation.

      $files = \App\Models\File::whereHas('material', function(\Illuminate\Database\Eloquent\Builder $material) {
          $material->whereHas('category', function(\Illuminate\Database\Eloquent\Builder $category) {
              $category->whereHas('bucket', function(\Illuminate\Database\Eloquent\Builder $bucket) {
                  $bucket->where('path', 'vbs-2020-focus');
              });
          });
      })->toSql();