mardi 22 décembre 2015

Constrain does not take effect when eager loading in laravel 5

i have this function to get the results from joining relationships. but how ever constrains seems not taking effect . if i comment out the constrain still it gives the same results set where as uncommented constrain

public function singleCategory($type, $category)
{
            $track = TrackType::with(['tracks.subgenres'], function($query, $category) {
                $query->where('name','=', $category);
            })->where('name', '=', $type)->get();

            dd($track->toArray());
}

Any help would be really appreciated :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire