public static function poolAdmin($poolId) { return PoolPlayer::with('user')->where('pool_id', '=', $poolId)->where('pool_admin', '=', 1)->first(); }
public function getPoolPlayers(Request $request, $id) { try { $players = PoolPlayer::with('user')->where('pool_id', '=', $id)->get(); foreach ($players as $player) { $player->totalSquareCount = $player->totalSquaresClaimed($id); $player->paidSquareCount = $player->totalSquaresBought($id); $player->oweSquareCount = $player->totalSquareCount - $player->paidSquareCount; } return response()->json($players); } catch (Exception $e) { return response()->json(array('error' => true, 'msg' => $e)); } }