Added Team model

This commit is contained in:
2018-06-01 23:55:10 +02:00
parent e5ffd93db7
commit f945285f77
3 changed files with 45 additions and 6 deletions

View File

@@ -3,12 +3,14 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Team;
class PagesController extends Controller class PagesController extends Controller
{ {
function dashboard() { function dashboard() {
$teams = Team::all();
return view('dashboard')->with([ return view('dashboard')->with([
$teams => 'teams',
]); ]);
} }
} }

34
tippspiel/app/Team.php Executable file
View File

@@ -0,0 +1,34 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Team extends Model
{
/**
* The database table uses by the model.
*
* @var string
*/
protected $table = 'team';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id',
'name',
];
/**
* The attributes excluded from the model's JSON form
*
* @var array
*/
protected $hidden = [
//
];
}

View File

@@ -24,20 +24,23 @@
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
<th scope="col">Type</th> <th scope="col">Nr.</th>
<th scope="col">Column heading</th> <th scope="col">Mannschaft A</th>
<th scope="col">Column heading</th> <th scope="col">Mannschaft B</th>
<th scope="col">Column heading</th> <th scope="col">Tipp</th>
<th scope="col">Bearbeiten</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($teams as $t)
<tr> <tr>
<th scope="row">Default</th> <th{!! $t->name !!}</th>
<td>Column content</td> <td>Column content</td>
<td>Column content</td> <td>Column content</td>
<td>Column content</td> <td>Column content</td>
</tr> </tr>
</tbody> </tbody>
@endforeach
</table> </table>
</div> </div>
</div> </div>