jeudi 2 mars 2017

Laravel relationship Column 'id' in where clause is ambiguous

I have courses and subscription types. I want to get all the courses that has a given subscription type. My attempt:

$courses=Course::wherehas('subscriptionType',function ($q)
        {
            return $q->where('id','1');
        })->get();

But this fails, Column 'id' in where clause is ambiguous. Any tips on doing this?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire