fork download
  1.  
  2. $match = $request->match;
  3. $sector = $request->sector;
  4.  
  5. $lot = Lot::select('chairs_sell', 'price_full', 'price_half')
  6. ->where('id_match', $match)->where('id_stadium_sector', $sector)->first();
  7.  
  8. if($lot['chairs_sell'] == null || $lot['chairs_sell'] == '') {
  9. $data = array(
  10. 'price_full_grandstand' => $lot['price_full'],
  11. 'price_half_grandstand' => $lot['price_half'],
  12. 'price_full_chair' => 0,
  13. 'price_half_chair' => 0
  14. );
  15. } else {
  16. $data = array(
  17. 'price_full_chair' => $lot['price_full'],
  18. 'price_half_chair' => $lot['price_half'],
  19. 'price_full_grandstand' => 0,
  20. 'price_half_grandstand' => 0
  21. );
  22. }
  23.  
  24. return response()->json($data);
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
$match = $request->match;
$sector = $request->sector;

$lot = Lot::select('chairs_sell', 'price_full', 'price_half')
    ->where('id_match', $match)->where('id_stadium_sector', $sector)->first();

if($lot['chairs_sell'] == null || $lot['chairs_sell'] == '') {
    $data = array(
        'price_full_grandstand'   => $lot['price_full'],
        'price_half_grandstand'   => $lot['price_half'],
        'price_full_chair'   => 0,
        'price_half_chair'   => 0
    );
} else {
    $data = array(
        'price_full_chair'   => $lot['price_full'],
        'price_half_chair'   => $lot['price_half'],
        'price_full_grandstand'   => 0,
        'price_half_grandstand'   => 0
    );
}

return response()->json($data);

        return response()->json($data);