lundi 8 février 2021

filter with Eloquent

I have 2 tables: tests, questions and I want to show the activated questions of a test:

$test = Test::whereHas('questions', function(Builder $query){
            $query->where('activated','=','1');
        })->find($id);

but I get the questions; activated and deactivated.

I thank you for your help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire