Answers for "Laravel query child from parent whereHas"

PHP
1

Laravel query child from parent whereHas

// Querying child relation "GamePlayer" with a condition
$gameList = Game::with(['GamePlayer','Category:id,name'])
         ->whereHas('GamePlayer', function ($q) use ($playerId) {
                      $q->where('player_id', $playerId);
   })->get();
Posted by: Guest on March-20-2022

Code answers related to "Laravel query child from parent whereHas"

Browse Popular Code Answers by Language