From c8f2a5138c14363e7c8cf113dc22db6ae948ee02 Mon Sep 17 00:00:00 2001 From: structix Date: Sat, 2 Jun 2018 01:24:51 +0200 Subject: [PATCH] Show tipp result on dashboard --- tippspiel/app/Http/Controllers/PagesController.php | 2 ++ tippspiel/app/Tipp.php | 1 + tippspiel/resources/views/dashboard.blade.php | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tippspiel/app/Http/Controllers/PagesController.php b/tippspiel/app/Http/Controllers/PagesController.php index 8758851..6bbf618 100644 --- a/tippspiel/app/Http/Controllers/PagesController.php +++ b/tippspiel/app/Http/Controllers/PagesController.php @@ -15,10 +15,12 @@ class PagesController extends Controller function dashboard() { $teams = Team::all(); $matches = Match::all(); + $tipps = Tipp::where('user', Auth::user()->id)->get(); return view('dashboard')->with([ 'teams' => $teams, 'matches' => $matches, + 'tipps' => $tipps, ]); } diff --git a/tippspiel/app/Tipp.php b/tippspiel/app/Tipp.php index 1baf692..f7b7f65 100755 --- a/tippspiel/app/Tipp.php +++ b/tippspiel/app/Tipp.php @@ -25,6 +25,7 @@ class Tipp extends Model 'matchid', 'resulta', 'resultb', + 'score', ]; /** diff --git a/tippspiel/resources/views/dashboard.blade.php b/tippspiel/resources/views/dashboard.blade.php index 2af7169..b684c43 100644 --- a/tippspiel/resources/views/dashboard.blade.php +++ b/tippspiel/resources/views/dashboard.blade.php @@ -39,12 +39,14 @@ {!! $teams->find($match->teama)->name !!} {!! $teams->find($match->teamb)->name !!} {!! $match->resulta . ':' . $match->resultb !!} - - + {!! $tipps->where('matchid', $match->id)->resulta . ':' . $tipps->where('matchid', $match->id)->resultb !!} + @if($tipps->where('matchid', $match->id)->resulta != null) {!! Form::model($match, ['method' => 'GET', 'action' => ['PagesController@createTipp', $match->id], 'style' => 'display:inline-block;']) !!} - +