skip to Main Content

Laravel – How to filter rows in query properly?

I want to filter records with relation which has another relation with conditions and with count > 0 Code: $classClass = ClassClass::query() ->with('parent') ->with('children', function (BelongsTo $query) { $query ->withCount(['serialNumbers' => function($query) { $query ->whereNull('serial_number_parent_id') ->whereNull('inherit_class_for_serial_number_id'); }]); }) ->where('parent_class_id','=', $class->id)…

VIEW QUESTION
Back To Top
Search