Show tipp result on dashboard
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@ class Tipp extends Model
|
||||
'matchid',
|
||||
'resulta',
|
||||
'resultb',
|
||||
'score',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user