Show tipp result on dashboard

This commit is contained in:
2018-06-02 01:24:51 +02:00
parent e5ecfa7bbf
commit c8f2a5138c
3 changed files with 7 additions and 2 deletions

View File

@@ -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,
]);
}

View File

@@ -25,6 +25,7 @@ class Tipp extends Model
'matchid',
'resulta',
'resultb',
'score',
];
/**

View File

@@ -39,12 +39,14 @@
<td>{!! $teams->find($match->teama)->name !!}</td>
<td>{!! $teams->find($match->teamb)->name !!}</td>
<td>{!! $match->resulta . ':' . $match->resultb !!}</td>
<td>-</td>
<td>{!! $tipps->where('matchid', $match->id)->resulta . ':' . $tipps->where('matchid', $match->id)->resultb !!}</td>
<td>
@if($tipps->where('matchid', $match->id)->resulta != null)
<!-- Edit -->
{!! Form::model($match, ['method' => 'GET', 'action' => ['PagesController@createTipp', $match->id], 'style' => 'display:inline-block;']) !!}
<button class="btn btn-primary" type="submit"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></button>
<button class="btn btn-primary" type="submit">Tipp!<button>
{!! Form::close() !!}
@endif
</td>
</tr>
</tbody>