Advertisement
topiqterkait

TournamentSchedule

Jul 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. public function schedule($tournamentId) {
  2.         $result1 = Tournament::get();
  3.         $result2 = TournamentSchedule::where('tournament.id', $tournamentId)->get();
  4.  
  5.         $dataDecode = json_decode($result1);
  6.         foreach($dataDecode[0]->tournaments as $r1) {
  7.             if($r1->id == $tournamentId) {
  8.                 $data['end_season'] = $r1->current_season->end_date;
  9.             } else {
  10.                 $data['end_season'] = date('Y-m-d',strtotime('-48 hours'));
  11.             }
  12.         }
  13.  
  14.         $dataDecode = json_decode($result2);
  15.         foreach($dataDecode as $r2) {
  16.             $data['last_update']  = date('d-m-Y H:i:s', strtotime($r2->generated_at));
  17.             $data['tournament']   = $r2->tournament;
  18.             $data['sport_events'] = $r2->sport_events;
  19.         }
  20.  
  21.         return view('tournament.schedule', $data);
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement