-
-
Save tsh-code/b0d025b1cea4266b80a33a404b8e689e to your computer and use it in GitHub Desktop.
Eloquent runner model
This file contains hidden or 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 | |
namespace Infrastructure\Eloquent\Model; | |
use Illuminate\Database\Eloquent\Model; | |
use Infrastucture\Eloquent\Model\RunResult; | |
class Runner extends Model | |
{ | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ | |
'id', | |
'email', | |
'password', | |
]; | |
/** | |
* The attributes that should be hidden for arrays. | |
* | |
* @var array | |
*/ | |
protected $hidden = [ | |
'password' | |
]; | |
/** | |
* @var string | |
*/ | |
protected $table = 'runners'; | |
/** | |
* @var string | |
*/ | |
protected $keyType = 'string'; | |
/** | |
* @var bool | |
*/ | |
public $timestamps = false; | |
/** | |
* @var bool | |
*/ | |
public $incrementing = false; | |
public function participations() | |
{ | |
return $this->hasMany(RunParticipation::class); | |
} | |
public function results() | |
{ | |
return $this->hasMany(RunResult::class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment