Created
March 18, 2016 09:10
-
-
Save kasparasg/937127b4167c2ccc2d71 to your computer and use it in GitHub Desktop.
modelling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class League extends Model | |
{ | |
public function teams() | |
{ | |
return $this->hasMany(Team::class); | |
} | |
} | |
class Team extends Model | |
{ | |
public function league() | |
{ | |
return $this->belongsTo(League::class); | |
} | |
} | |
class Referee extends Model | |
{ | |
public function match() | |
{ | |
return $this->belongsTo(Match::class); | |
} | |
} | |
class Score extends Model | |
{ | |
public function match() | |
{ | |
return $this->belongsTo(Match::class) | |
} | |
} | |
class Match extends Model | |
{ | |
public function referee() | |
{ | |
return $this->hasOne(Referee::class); | |
} | |
public function homeTeam() | |
{ | |
return $this->hasOne(Team::class); | |
} | |
public function awayTeam() | |
{ | |
return $this->hasOne(Team::class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment