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.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3q37oLP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire