From 52033e93aad0a9571a779dc7af26696e3657f8f9 Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck Date: Tue, 25 Sep 2018 17:04:24 +0200 Subject: [PATCH] Updated blade to format Updated blade to format --- resources/views/leagues.blade.php | 69 ++++++++++---------- resources/views/livescores_now.blade.php | 46 ++++++++------ resources/views/livescores_today.blade.php | 74 ++++++++++++++++------ 3 files changed, 118 insertions(+), 71 deletions(-) diff --git a/resources/views/leagues.blade.php b/resources/views/leagues.blade.php index ce632ad9..ed995751 100644 --- a/resources/views/leagues.blade.php +++ b/resources/views/leagues.blade.php @@ -3,40 +3,43 @@ @section('content')
-

Leagues

+ @php + echo "

Leagues

"; - @if(isset($leagues)) - @if(count($leagues) >= 2) - - - - - - - - - @foreach($leagues as $league) - - {{----}} - - @php - if($league->country->data->extra != null) { - $flag_code = strtolower($league->country->data->extra->iso); - echo ""; - } elseif ($league->country->data->name == "Europe") { - echo ""; - } else { - echo ""; - } - @endphp - - @endforeach - -
League nameCountry
{{$league->'name'}} {{$league->name}} " . $league->country->data->name . "   " . $league->country->data->name . "   " . $league->country->data->name . "
- @else -

{{ $leagues }}

- @endif - @endif + if(isset($leagues)) { + if(count($leagues) >= 1) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + foreach($leagues as $league) { + echo ""; + echo ""; + if($league->country->data->extra != null) { + $flag_code = strtolower($league->country->data->extra->iso); + echo ""; + } elseif ($league->country->data->name == "Europe") { + echo ""; + } else { + echo ""; + } + echo ""; + } + echo ""; + echo "
League nameCountry
" . $league->name . " " . $league->country->data->name . "   " . $league->country->data->name . "   " . $league->country->data->name . "
"; + echo "
"; + echo $leagues->links(); + echo "
"; + } else { + echo "

{{ $leagues }}

"; + } + } + + @endphp
@endsection \ No newline at end of file diff --git a/resources/views/livescores_now.blade.php b/resources/views/livescores_now.blade.php index 984785bd..fbb1cb73 100644 --- a/resources/views/livescores_now.blade.php +++ b/resources/views/livescores_now.blade.php @@ -4,47 +4,55 @@
@php - echo "

Livescores In-play - " . date("Y-m-d") . "

"; + echo "

Livescores in-play - " . date("Y-m-d") . "

"; if(isset($livescores)) { - if(count($livescores) >= 2) { + if(count($livescores) >= 1) { + if(count($livescores) == 100) { + echo "

We only show the first 100 results. The data shown might now be complete. We try to fix this in a later version.

"; + } $last_league_id = 0; foreach($livescores as $livescore) { + if(in_array($livescore->time->status, array('NS', 'FT', 'FT_PEN', 'CANCL', 'POSTP', 'INT', 'ABAN', 'SUSP', 'AWARDED', 'DELAYED', 'TBA', 'WO', 'AU'))) { + continue; + } $league = $livescore->league->data; $homeTeam = $livescore->localTeam->data; $awayTeam = $livescore->visitorTeam->data; if($livescore->league_id == $last_league_id) { echo ""; - echo "" . $homeTeam->name . ""; - echo "" . $awayTeam->name . ""; - echo "" . $livescore->scores->ft_score . ""; - echo "" . $livescore->time->starting_at->date_time . ""; + echo "" . $homeTeam->name . ""; + echo "" . $awayTeam->name . ""; + echo "" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . ""; + echo "" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . ""; + echo "Details"; //link to details page (fixtures/{id}) echo ""; } else { - echo ""; + echo "
"; echo "

" . $league->name . "

"; // add link to league-details page - echo ""; - echo ""; - echo ""; - echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; //link to details page (fixtures/{id}) echo ""; } $last_league_id = $livescore->league_id; } + if($last_league_id == 0) { + echo "

No livescores in-play right now.

"; + } } else { echo "

No livescores in-play right now.

"; } diff --git a/resources/views/livescores_today.blade.php b/resources/views/livescores_today.blade.php index a86bf91a..074a823d 100644 --- a/resources/views/livescores_today.blade.php +++ b/resources/views/livescores_today.blade.php @@ -7,41 +7,77 @@ echo "

Livescores - " . date("Y-m-d") . "

"; if(isset($livescores)) { - if(count($livescores) >= 2) { + if(count($livescores) >= 1 && gettype($livescores) == 'array') { + if(count($livescores) == 100) { + echo "

We only show the first 100 results. The data shown might now be complete. We try to fix this in a later version.

"; + } $last_league_id = 0; foreach($livescores as $livescore) { + if(in_array($livescore->time->status, array('LIVE', 'HT', 'ET', 'PEN_LIVE', 'AET', 'BREAK', 'AU'))) { + continue; + } $league = $livescore->league->data; $homeTeam = $livescore->localTeam->data; $awayTeam = $livescore->visitorTeam->data; + if($livescore->scores->localteam_score > $livescore->scores->visitorteam_score && $livescore->time->status == 'FT') { + $winningTeam = $homeTeam->name; + } elseif ($livescore->scores->localteam_score == $livescore->scores->visitorteam_score && $livescore->time->status == 'FT'){ + $winningTeam = 'draw'; + } elseif ($livescore->scores->localteam_score < $livescore->scores->visitorteam_score && $livescore->time->status == 'FT') { + $winningTeam = $awayTeam->name; + } else { + $winningTeam = 'TBD'; + } if($livescore->league_id == $last_league_id) { echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + if($winningTeam == $homeTeam->name) { + echo ""; + echo ""; + } elseif($winningTeam == $awayTeam->name) { + echo ""; + echo ""; + } elseif($winningTeam == 'draw') { + echo ""; + echo ""; + } else { + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; //link to details page (fixtures/{id}) echo ""; } else { - echo "
Home teamAway teamResultDate and timeHome teamAway teamScoreDate and timeDetails
" . $homeTeam->name . "" . $awayTeam->name . "" . $livescore->scores->ft_score . "" . $livescore->time->starting_at->date_time . "" . $homeTeam->name . "" . $awayTeam->name . "" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "Details
" . $homeTeam->name . "" . $awayTeam->name . "" . $livescore->scores->ft_score . "" . $livescore->time->starting_at->date_time . "" . $homeTeam->name . "" . $awayTeam->name . "" . $homeTeam->name . "" . $awayTeam->name . "" . $homeTeam->name . "" . $awayTeam->name . "" . $homeTeam->name . "" . $awayTeam->name . "" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "Details
"; + echo "
"; echo "

" . $league->name . "

"; // add link to league-details page - echo ""; - echo ""; - echo ""; - echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + if($winningTeam == $homeTeam->name) { + echo ""; + echo ""; + } elseif($winningTeam == $awayTeam->name) { + echo ""; + echo ""; + } elseif($winningTeam == 'draw') { + echo ""; + echo ""; + } else { + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; //link to details page (fixtures/{id}) + echo ""; } $last_league_id = $livescore->league_id; }
Home teamAway teamResultDate and timeHome teamAway teamScoreDate and timeDetails
" . $homeTeam->name . "" . $awayTeam->name . "" . $livescore->scores->ft_score . "" . $livescore->time->starting_at->date_time . "
" . $homeTeam->name . "" . $awayTeam->name . "" . $homeTeam->name . "" . $awayTeam->name . "" . $homeTeam->name . "" . $awayTeam->name . "" . $homeTeam->name . "" . $awayTeam->name . "" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "Details